github wants the User-Agent header properly set

This commit is contained in:
lilydjwg 2017-07-08 16:06:33 +08:00
parent 1bb14397ed
commit c81a826c57
1 changed files with 4 additions and 1 deletions

View File

@ -23,7 +23,10 @@ async def get_version(name, conf):
url = GITHUB_MAX_TAG % repo url = GITHUB_MAX_TAG % repo
else: else:
url = GITHUB_URL % (repo, br) url = GITHUB_URL % (repo, br)
headers = {'Accept': "application/vnd.github.quicksilver-preview+json"} headers = {
'Accept': 'application/vnd.github.quicksilver-preview+json',
'User-Agent': 'lilydjwg/nvchecker',
}
if 'NVCHECKER_GITHUB_TOKEN' in os.environ: 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']