Created
October 10, 2023 16:30
-
-
Save ewistrand/74c4e27cc5424b6501cda265921b9e27 to your computer and use it in GitHub Desktop.
Loop through paged request with Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
resp = requests.get('https://url.com/api/endpoint').json() | |
data = resp['data'] | |
while resp['next_page_url']: | |
resp = requests.get(resp['next_page_url']).json() | |
data.extend(resp['data']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment