Hello - I've written a python script using the Meraki SDK to retrieve subnets from our org, about 600 networks, about 3 vlans/subnets per network. I'd like to compile a list and sort/organize all the subnets.
The script works fine if I limit it to the first 10. If I "unleash it", it crashes after about 30 networks. Error messages are coming from inside the SDK - it appears to be rate limiting.
Google fu suggested using "ratelimit" package - ratelimit with a decorator around functions making calls.
@limits(calls=10, period=1)
However, this hasn't helped. Googling and watching cisco/meraki videos is talking about making API calls, and that the SDK magically takes care of ratel imiting. I'm looking for the actual reference, in the SDK documentation, to how to configure rate limiting, how to check on it, troubleshoot, etc.
My function call, that appears to be over running the ratelimit.
@limits(calls=10, period=1)
def get_vlans(client, network_id):
"""Get the subnets of the network(branch). The branch will have multiple subnets
Return format: [{"name":vlanA, "subnet":"1.2.3.4/24"}, {"name":"vlanB", "subnet":"1.2.3.4/24"} ]"""
vlans_controller = client.vlans
results = vlans_controller.get_network_vlans(network_id)
subnets = []
for item in results:
a_subnet = {} #
a_subnet['name'] = item['name']
a_subnet['subnet'] = item['subnet']
subnets.append(a_subnet) # Adding an invididual vlan dictionary to the list of subnets.
mx_vlans = subnets
return mx_vlans
Thanks