Have some snippets of code I can share, but not a whole solution.
You need to get the group policy ID. I used this for processing a large number of networks, so cache the group policy results, but you may not need that complexity.
def getGPId(dashboard,netId,gpName):
global groupPolicies
# If we don't have a cache of group polcies - build it now
if groupPolicies.get(netId)==None:
groupPolicies[netId]=dashboard.networks.getNetworkGroupPolicies(netId)
# Search for the group policy name
for gp in groupPolicies[netId]:
if gp['name']==gpName:
return(gp['groupPolicyId'])
raise SystemExit("Invalid group policy name supplied: "+gpName)
And then something like:
def applyGP(dashboard,orgId,net,netId):
gpId=getGPId(dashboard,netId,"GP Name")
...
for client in dashboard.networks.getNetworkClients(netId,total_pages='all',timespan=1*86400,vlan=2):
...
dashboard.networks.updateNetworkClientPolicy(netId,client['id'],'Group policy',groupPolicyId=gpId)