Skip to content

Instantly share code, notes, and snippets.

@timeu
Created February 19, 2018 13:54
Show Gist options
  • Save timeu/ce7207fd2313eb96602ff9b583128574 to your computer and use it in GitHub Desktop.
Save timeu/ce7207fd2313eb96602ff9b583128574 to your computer and use it in GitHub Desktop.
import requests, csv
req = requests.get('https://arapheno.1001genomes.org/rest/phenotype/list.json')
for phen in req.json():
id = phen['phenotype_id']
filename = '/tmp/DATA/%s_%s.csv' % (id,phen['name'])
with open(filename, 'w') as fh:
data = requests.get('https://arapheno.1001genomes.org/rest/phenotype/%s/values.csv' % id)
for chunk in data.iter_content(chunk_size=128):
fh.write(chunk)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment