use preview redirect api regardless if access token is set

This commit is contained in:
Jiachen Yang 2015-05-12 08:28:27 +09:00
parent 41df426ca5
commit bdf5efdb76
1 changed files with 2 additions and 5 deletions

View File

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