Mercurial > repos > iuc > pangolin
view fetch_latest_pangolearn.py @ 5:42a174224817 draft
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/pangolin commit 93a8521684d03889f607b8c43db5539d9a0de8d0"
| author | iuc |
|---|---|
| date | Mon, 21 Jun 2021 16:14:55 +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()
