github.lister: Filter out partial repositories which break listing

This commit fixes the repository mapping to model. It broke when the listed
repository was either None or missing the id field [1]

[1] https://sentry.softwareheritage.org/share/issue/532d682182fc43d6a7a99400e3928811/
This commit is contained in:
Antoine R. Dumont (@ardumont) 2020-01-20 10:06:34 +01:00
parent 99fcd2b3f5
commit ed73cea771
No known key found for this signature in database
GPG key ID: 52E2E9840D10C3B8
2 changed files with 6 additions and 1 deletions

View file

@ -49,7 +49,8 @@ class GitHubLister(IndexingHttpLister):
def transport_response_simplified(self, response):
repos = response.json()
return [self.get_model_from_repo(repo) for repo in repos]
return [self.get_model_from_repo(repo)
for repo in repos if repo and 'id' in repo]
def request_headers(self):
"""(Override) Set requests headers to send when querying the GitHub API

View file

@ -66,6 +66,10 @@
"releases_url": "https://api.github.com/repos/mojombo/grit/releases{/id}",
"deployments_url": "https://api.github.com/repos/mojombo/grit/deployments"
},
{
"description": "Azure Qu..."
},
{},
{
"id": 26,
"node_id": "MDEwOlJlcG9zaXRvcnkyNg==",