Commit d4b6e983 authored by Aleks Kissinger's avatar Aleks Kissinger

pushed auth into query string for gh-get

parent 4b062a6a
......@@ -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()
......@@ -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))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment