Created
June 18, 2021 21:56
-
-
Save ThomasWunderlich/f6157b02a522ea821df8a6ee1d798023 to your computer and use it in GitHub Desktop.
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 | |
page = 1 | |
download = True | |
while download: | |
payload = {'page': page, 'per_page': 80} | |
results = requests.get('https://api.punkapi.com/v2/beers', params=payload) | |
results = results.json() | |
# pull the plug if empty | |
if not results: | |
download = False | |
continue | |
for result in results: | |
# download all data to a file so you can spot check the data format. | |
print(result["name"] + ", " + result["first_brewed"]) | |
page += 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment