Permalink
Browse files

Merge pull request #2 from bmwiedemann/master

use github credentials if available
  • Loading branch information...
2 parents 618cc9b + 7a17908 commit a9992b940770775a843480a7dcd343a9813d4d91 @mapleoin committed Apr 3, 2013
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:

0 comments on commit a9992b9

Please sign in to comment.