# no api_key specified below it uses environment variable "MERAKI_DASHBOARD_API_KEY"
Merakiclient = meraki.DashboardAPI(api_key='',
wait_on_rate_limit = True,
maximum_retries = 2,
log_file_prefix = __file__[:-3],
log_path='')
orgs = Merakiclient.organizations.getOrganizations()
orgid=orgs['id'] # use above API getorgs() call or code the orgid here
newRelayServers = ['se.rv.er.01, se.rv.er.02']
networks = Merakiclient.networks.getOrganizationNetworks(orgid)
for network in networks:
print('Processing network: ',network['name'])
vlans = Merakiclient.vlans.getNetworkVlans(network['id'])
for vlan in vlans:
print('Processing Vlan: {} - {}'.format(vlan['id'], vlan['name']))
if vlan['dhcpHandling'] == 'Relay DHCP to another server':
result = Merakiclient.vlans.updateNetworkVlan(network['id'], str(vlan['id']),
dhcpRelayServerIps = newRelayServers)
updatedVlan = Merakiclient.vlans.getNetworkVlan(network['id'], vlan['id'])
print('Vlan {} DHCP Relay Servers after update: {}'.format(updatedVlan['id'],
updatedVlan['dhcpRelayServerIps']))
Larry