This is how I handle my pagination. I don't use the Meraki SDK since I can't install in on my corporate desktop 🙂
def getswitchports():
pages = 0
results = []
geturl = '{0}/organizations/{1}/switch/ports/bySwitch'.format(str(base_url_v1), str(orgid))
dashboard = requests.get(geturl, headers=headers,verify=False)
if dashboard.status_code == 200:
raw = dashboard.json()
for i in raw:
results.append(i)
while 'next' in dashboard.links :
dashboard = requests.get(dashboard.links['next']['url'],headers=headers,verify=False,timeout=25)
raw = dashboard.json()
pages = pages + 1
for i in raw:
results.append(i)
print(pages)
return (results)