From d4b6e9839823e27af646a915436462254758e053 Mon Sep 17 00:00:00 2001 From: Aleks Kissinger Date: Mon, 14 Jan 2019 13:19:52 +0100 Subject: pushed auth into query string for gh-get --- scripts/gh-get.py | 4 ++-- scripts/gh.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/gh-get.py b/scripts/gh-get.py index 9d9693f..bf95d97 100644 --- a/scripts/gh-get.py +++ b/scripts/gh-get.py @@ -14,9 +14,9 @@ draft = [r for r in gh('releases') if r['draft']][0] for a in draft['assets']: if filter == None or filter in a['name']: print('Downloading ' + a['name']) - b = gh('releases/assets/%s' % a['id'], + b = gh('releases/assets/%s?access_token=%s' % (a['id'], tok), ['-L', '-H', 'Accept: application/octet-stream'], - parse=False, quiet=False) + parse=False, quiet=False, auth=False) f = open(a['name'], 'w') f.write(b) f.close() diff --git a/scripts/gh.py b/scripts/gh.py index d12b416..81db1b2 100644 --- a/scripts/gh.py +++ b/scripts/gh.py @@ -13,11 +13,11 @@ if tok == '': def pr(j): print(json.dumps(j, indent=2)) # call GitHub API with curl -def gh(s, args=[], quiet=True, parse=True): +def gh(s, args=[], quiet=True, parse=True, auth=True): cmd = (["curl"] + (["-s"] if quiet else []) + args + - ["-H", "Authorization: token " + tok] + + (["-H", "Authorization: token " + tok] if auth else []) + [s if 'https://' in s else api_url + '/' + s]) # ONLY UN-COMMENT FOR TESTING: # print(' '.join(cmd)) -- cgit v1.2.3