From 1e12cc720b4db72a8b76f19f21456f10a6ef4f8e Mon Sep 17 00:00:00 2001 From: Hedy Li Date: Thu, 8 Oct 2020 03:31:46 +0000 Subject: fix for when pr has no labels --- bot/exts/halloween/hacktoberstats.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'bot') diff --git a/bot/exts/halloween/hacktoberstats.py b/bot/exts/halloween/hacktoberstats.py index 50608d56..f4b8f51c 100644 --- a/bot/exts/halloween/hacktoberstats.py +++ b/bot/exts/halloween/hacktoberstats.py @@ -298,6 +298,7 @@ class HacktoberStats(commands.Cog): continue topics_query_url = f"https://api.github.com/repos/{shortname}/topics" + log.debug("Fetching repo topics for " + shortname + " with url: " + topics_query_url) async with aiohttp.ClientSession() as session: async with session.get(topics_query_url, headers=GITHUB_TOPICS_ACCEPT_HEADER) as resp: jsonresp2 = await resp.json() @@ -307,6 +308,8 @@ class HacktoberStats(commands.Cog): # PRs after must be in repo with 'hacktoberfest' topic # unless it has 'hacktoberfest-accepted' label + if not ("labels" in jsonresp.keys()): + continue if ("hacktoberfest" in jsonresp2["names"]) or ("hacktoberfest-accpeted" in jsonresp["labels"]): outlist.append(itemdict) return outlist -- cgit v1.2.3