I have had luck with using a Throttler, but you have to play with the timers sometimes. It will also depend if you have other scripts running against the API on your ORG, which will impact your rate limit. from asyncio_throttle import Throttler
# Used to control flow of API calls to the API interface
throttler = Throttler(rate_limit=16, period=1)
# snip of code
async def gather_ports(aiomeraki, serial):
# had to use throttler or it would overun the API.
async with throttler:
try:
switch_ports = await aiomeraki.switch.getDeviceSwitchPorts(serial)
except meraki.AsyncAPIError as e:
print(f"Meraki API error: {e}")
except Exception as e:
print(f"some other error: {e}")
... View more