Skip to content

Commit

Permalink
Fix malformed API response
Browse files Browse the repository at this point in the history
Attempt to handle issue #3, but we'll see...
  • Loading branch information
jstrieb committed Oct 5, 2020
1 parent b0114e5 commit af2c19c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions github_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,10 @@ async def lines_changed(self) -> Tuple[int, int]:
for repo in await self.repos:
r = await self.queries.query_rest(f"/repos/{repo}/stats/contributors")
for author_obj in r:
# Handle malformed response from the API by skipping this repo
if (not isinstance(author_obj, dict)
or not isinstance(author_obj.get("author", {}), dict)):
continue
author = author_obj.get("author", {}).get("login", "")
if author != self.username:
continue
Expand Down

0 comments on commit af2c19c

Please sign in to comment.