Skip to content

Instantly share code, notes, and snippets.

@ThomasWunderlich
Created June 18, 2021 21:56
Show Gist options
  • Save ThomasWunderlich/f6157b02a522ea821df8a6ee1d798023 to your computer and use it in GitHub Desktop.
Save ThomasWunderlich/f6157b02a522ea821df8a6ee1d798023 to your computer and use it in GitHub Desktop.
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