Mercurial > repos > iuc > pangolin
comparison fetch_latest_pangolearn.py @ 1:f557122d379e draft
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/pangolin commit 1522bdb834ffab157d1ca25e6e74db21f62e3aae"
author | iuc |
---|---|
date | Sun, 25 Apr 2021 20:17:07 +0000 |
parents | |
children | 437e28791761 |
comparison
equal
deleted
inserted
replaced
0:0ec813ad2910 | 1:f557122d379e |
---|---|
1 #!/usr/bin/env python | |
2 | |
3 import json | |
4 import os | |
5 import tarfile | |
6 | |
7 # rely on the fact that pangolin itself uses the requests module | |
8 import requests | |
9 | |
10 response = requests.get( | |
11 "https://api.github.com/repos/cov-lineages/pangoLEARN/releases/latest" | |
12 ) | |
13 if response.status_code == 200: | |
14 details = json.loads(response.text) | |
15 response = requests.get(details["tarball_url"]) | |
16 if response.status_code == 200: | |
17 with open("pangolearn.tgz", "wb") as handle: | |
18 handle.write(response.content) | |
19 tf = tarfile.open("pangolearn.tgz") | |
20 pl_path = tf.next().name | |
21 tf.extractall() | |
22 tf.close() | |
23 os.rename(os.path.join(pl_path, "pangoLEARN"), "datadir") | |
24 else: | |
25 response.raise_for_status() | |
26 else: | |
27 response.raise_for_status() |