Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

use github credentials if available #2

Merged
merged 1 commit into from

2 participants

@bmwiedemann

this is important to not hit the rate limit of 60/h
but have the higher 5000/h limit for authenticated users

@bmwiedemann bmwiedemann use github credentials if available
this is important to not hit the rate limit of 60/h
but have the higher 5000/h limit for authenticated users
7a17908
@mapleoin mapleoin merged commit a9992b9 into mapleoin:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 2, 2013
  1. @bmwiedemann

    use github credentials if available

    bmwiedemann authored
    this is important to not hit the rate limit of 60/h
    but have the higher 5000/h limit for authenticated users
This page is out of date. Refresh to see the latest.
Showing with 10 additions and 1 deletion.
  1. +10 −1 github_tarballs
View
11 github_tarballs
@@ -25,8 +25,16 @@ import tarfile
import urllib
+GITHUB_CREDS = ""
+conffilebase = "github_tarballs_credentials"
+try:
+ f = open(os.path.join(os.path.expanduser('~'), '.' + conffilebase))
+ GITHUB_CREDS = f.read().rstrip('\n') + '@'
+except IOError:
+ pass
+
COMMIT_HASH_SIZE = 7
-GITHUB_COMPARE = "https://api.github.com/repos/%(owner)s/%(repo)s/compare/%(base)s...%(head)s"
+GITHUB_COMPARE = "https://%(creds)sapi.github.com/repos/%(owner)s/%(repo)s/compare/%(base)s...%(head)s"
def download_tarball(url, filename):
@@ -168,6 +176,7 @@ def get_changes(package, owner, repo, target):
current_commit = get_commit_from_spec(package)
url = GITHUB_COMPARE % dict(owner=owner,
repo=repo,
+ creds=GITHUB_CREDS,
base=current_commit or target,
head=target)
try:
Something went wrong with that request. Please try again.