Created
May 23, 2022 20:43
-
-
Save mtholder/615f1f77af9b7db8f0f9220fa514ab07 to your computer and use it in GitHub Desktop.
grab a newick tree from timetree for your personal research and teaching use if you have the study id (passed in as a command line arg)
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
#!/usr/bin/env python | |
import requests | |
import sys | |
durl = 'http://www.timetree.org/ajax/newick/publishedtree/download' | |
for i in sys.argv[1:]: | |
url = 'http://www.timetree.org/api/widget/citation_data/{i}'.format(i=i) | |
s = requests.Session() | |
r = s.get(url) | |
nr = s.post(durl, data={'export': 'newick', 'rank': 'na'}) | |
nr.raise_for_status() | |
print(nr.text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment