Skip to content

Commit

Permalink
Merge pull request #2 from bmwiedemann/master
Browse files Browse the repository at this point in the history
use github credentials if available
  • Loading branch information
iartarisi committed Apr 3, 2013
2 parents 618cc9b + 7a17908 commit a9992b9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion github_tarballs
Expand Up @@ -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):
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit a9992b9

Please sign in to comment.