]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
build-integration-branch: send token in the header
authorKefu Chai <kchai@redhat.com>
Sat, 17 Oct 2020 03:09:49 +0000 (11:09 +0800)
committerKefu Chai <kchai@redhat.com>
Sat, 17 Oct 2020 03:09:53 +0000 (11:09 +0800)
see
https://developer.github.com/changes/2020-02-10-deprecating-auth-through-query-param/

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/script/build-integration-branch

index f5cc4c10644e58aac7c22b92bc68b3ed3ec65a01..511a950d44b476731fae4a276a4282057345642d 100755 (executable)
@@ -62,16 +62,15 @@ with open(os.environ['HOME'] + '/.github_token', 'r') as myfile:
 # get prs
 baseurl = urljoin('https://api.github.com', (
                       'repos/{repo}/issues?labels={label}'
-                      '&access_token={token}'
                       '&sort=created'
                       '&direction=asc'
                     )
                  )
 url = baseurl.format(
     label=label,
-    repo=repo,
-    token=token)
-r = requests.get(url)
+    repo=repo)
+r = requests.get(url,
+                 headers={'Authorization': 'token %s' % token})
 assert(r.ok)
 j = json.loads(r.text or r.content)
 print("--- found %d issues tagged with %s" % (len(j), label))
@@ -81,7 +80,8 @@ prtext = []
 for issue in j:
     if 'pull_request' not in issue:
         continue
-    r = requests.get(issue['pull_request']['url'] + '?access_token=' + token)
+    r = requests.get(issue['pull_request']['url'],
+                     headers={'Authorization': 'token %s' % token})
     pr = json.loads(r.text or r.content)
     prs.append(pr)
     prtext.append(pr['html_url'] + ' - ' + pr['title'])