Last active
February 13, 2019 21:32
-
-
Save acoffman/5899dcd565878afcd1b3a83a50381ceb to your computer and use it in GitHub Desktop.
Get All CIViC Variants
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 | |
next_url = 'https://civicdb.org/api/variants?count=100' | |
variants = [] | |
while next_url: | |
response = requests.get(nextUrl) | |
body = response.json() | |
variants += body['records'] | |
next_url = body['_meta']['links']['next'] | |
print('Retrieved {}, the last of which is named {}.'.format(len(variants), variants[-1]['name'])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment