Mercurial > repos > earlhaminst > ensembl_get_sequences
comparison get_feature_info.py @ 6:7af66c2b3831 draft default tip
"planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/Ensembl-REST commit 17c65045b726d0695814bfe761e534f6521786f1"
author | earlhaminst |
---|---|
date | Tue, 20 Oct 2020 15:07:23 +0000 |
parents | 0fa1d1cc417d |
children |
comparison
equal
deleted
inserted
replaced
5:0fa1d1cc417d | 6:7af66c2b3831 |
---|---|
21 options, args = parser.parse_args() | 21 options, args = parser.parse_args() |
22 if options.input is None: | 22 if options.input is None: |
23 raise Exception('-i option must be specified') | 23 raise Exception('-i option must be specified') |
24 | 24 |
25 | 25 |
26 server = 'http://rest.ensembl.org' | 26 server = 'https://rest.ensembl.org' |
27 ext = 'lookup/id' | 27 ext = 'lookup/id' |
28 | 28 |
29 headers = {'Content-Type': 'application/json', 'Accept': 'application/json'} | 29 headers = {'Content-Type': 'application/json', 'Accept': 'application/json'} |
30 params = dict((k, getattr(options, k)) for k in ['format', 'expand']) | 30 params = dict((k, getattr(options, k)) for k in ['format', 'expand']) |
31 | 31 |
40 break | 40 break |
41 if not first: | 41 if not first: |
42 print(",") | 42 print(",") |
43 data = {'ids': ids} | 43 data = {'ids': ids} |
44 r = requests.post(urljoin(server, ext), params=params, headers=headers, | 44 r = requests.post(urljoin(server, ext), params=params, headers=headers, |
45 data=json.dumps(data)) | 45 data=json.dumps(data), allow_redirects=False) |
46 | 46 |
47 if not r.ok: | 47 if not r.ok: |
48 r.raise_for_status() | 48 r.raise_for_status() |
49 | 49 |
50 print(r.text[1:-1]) | 50 print(r.text[1:-1]) |