Skip to content
This repository was archived by the owner on Nov 2, 2023. It is now read-only.

Commit 46f629c

Browse files
committed
check if there is categories before commiting to the result
1 parent 6963c82 commit 46f629c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

wekeypedia/wikipedia/page.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -544,9 +544,9 @@ def get_categories(self, extra_params={}):
544544
while True:
545545
r = api.get(params)
546546

547-
c = r["query"]["pages"][ self.page_id ]["categories"]
548-
549-
categories.extend(c)
547+
if "categories" in r["query"]["pages"][ self.page_id ]:
548+
c = r["query"]["pages"][ self.page_id ]["categories"]
549+
categories.extend(c)
550550

551551
if "continue" in r:
552552
params.update(r["continue"])

0 commit comments

Comments
 (0)