Mercurial > repos > iuc > pangolin
view fetch_latest_pangolearn.py @ 3:514a786baaa9 draft
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/pangolin commit e4e6f491964a162964882db4e53e36803ceaab9e"
author | iuc |
---|---|
date | Wed, 19 May 2021 13:32:34 +0000 |
parents | f557122d379e |
children | 437e28791761 |
line wrap: on
line source
#!/usr/bin/env python import json import os import tarfile # rely on the fact that pangolin itself uses the requests module import requests response = requests.get( "https://api.github.com/repos/cov-lineages/pangoLEARN/releases/latest" ) if response.status_code == 200: details = json.loads(response.text) response = requests.get(details["tarball_url"]) if response.status_code == 200: with open("pangolearn.tgz", "wb") as handle: handle.write(response.content) tf = tarfile.open("pangolearn.tgz") pl_path = tf.next().name tf.extractall() tf.close() os.rename(os.path.join(pl_path, "pangoLEARN"), "datadir") else: response.raise_for_status() else: response.raise_for_status()