Use a uniform User-Agent on all listers

This also adds tests to make sure that we properly send our version number to
upstreams.
This commit is contained in:
Nicolas Dandrimont 2019-11-22 13:12:58 +01:00
parent 62dc4dc257
commit ff7fdf24db
9 changed files with 48 additions and 8 deletions

View file

@ -54,7 +54,12 @@ class GitHubLister(IndexingHttpLister):
return [self.get_model_from_repo(repo) for repo in repos]
def request_headers(self):
return {'Accept': 'application/vnd.github.v3+json'}
"""(Override) Set requests headers to send when querying the GitHub API
"""
headers = super().request_headers()
headers['Accept'] = 'application/vnd.github.v3+json'
return headers
def disable_deleted_repo_tasks(self, index, next_index, keep_these):
""" (Overrides) Fix provided index value to avoid erroneously disabling