handle github repo redirects using preview api

This commit is contained in:
Jiachen Yang 2015-05-12 08:06:42 +09:00
parent c3c16247b7
commit 41df426ca5

View file

@ -12,7 +12,10 @@ def get_version(name, conf, callback):
url = GITHUB_URL % (repo, br)
headers = {}
if 'NVCHECKER_GITHUB_TOKEN' in os.environ:
headers = {'Authorization': 'token %s' % os.environ['NVCHECKER_GITHUB_TOKEN']}
headers = {
'Authorization': 'token %s' % os.environ['NVCHECKER_GITHUB_TOKEN'],
'Accept': "application/vnd.github.quicksilver-preview+json"
}
request = HTTPRequest(url, headers=headers)
AsyncHTTPClient().fetch(request, user_agent='lilydjwg/nvchecker',
callback=partial(_github_done, name, callback))