arrow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From w...@apache.org
Subject arrow git commit: ARROW-218: Add optional API token authentication option to PR merge tool
Date Thu, 16 Jun 2016 17:50:46 GMT
Repository: arrow
Updated Branches:
  refs/heads/master b4e0e93d5 -> 790d5412d


ARROW-218: Add optional API token authentication option to PR merge tool

You can use an API token with extremely limited privileges (i.e., only access to public GitHub
repos), but this helps avoid rate limiting issues on shared outbound IP addresses.

Author: Wes McKinney <wesm@apache.org>

Closes #91 from wesm/ARROW-218 and squashes the following commits:

f45808c [Wes McKinney] Add optional GitHub API token to patch tool (to avoid rate limiting
issues with unauthenticated requests)


Project: http://git-wip-us.apache.org/repos/asf/arrow/repo
Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/790d5412
Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/790d5412
Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/790d5412

Branch: refs/heads/master
Commit: 790d5412da67f807159f236179a8a7df37b270d2
Parents: b4e0e93
Author: Wes McKinney <wesm@apache.org>
Authored: Thu Jun 16 10:50:40 2016 -0700
Committer: Wes McKinney <wesm@apache.org>
Committed: Thu Jun 16 10:50:40 2016 -0700

----------------------------------------------------------------------
 dev/merge_arrow_pr.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/arrow/blob/790d5412/dev/merge_arrow_pr.py
----------------------------------------------------------------------
diff --git a/dev/merge_arrow_pr.py b/dev/merge_arrow_pr.py
index fe0bcd1..981779f 100755
--- a/dev/merge_arrow_pr.py
+++ b/dev/merge_arrow_pr.py
@@ -66,7 +66,17 @@ os.chdir(ARROW_HOME)
 
 def get_json(url):
     try:
-        return json.load(urllib2.urlopen(url))
+        from urllib2 import urlopen, Request
+        env_var = 'ARROW_GITHUB_API_TOKEN'
+
+        if env_var in os.environ:
+            token = os.environ[env_var]
+            request = Request(url)
+            request.add_header('Authorization', 'token %s' % token)
+            response = urlopen(request)
+        else:
+            response = urlopen(url)
+        return json.load(response)
     except urllib2.HTTPError as e:
         print "Unable to fetch URL, exiting: %s" % url
         sys.exit(-1)


Mime
View raw message