jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/609491 )

Change subject: Fix fatal errors caused by dicts lacking "title" attribute
......................................................................

Fix fatal errors caused by dicts lacking "title" attribute

In data/api.py, line 3040, occasionally the Wikimedia API will return a data 
item
that lacks a "title" attribute, causing a fatal error. This patch skips those 
items.

Change-Id: Id0bb248af1333fff88857c0e61c21f0602e0ebf4
---
M pywikibot/data/api.py
1 file changed, 2 insertions(+), 2 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index 8a80457..c8851d5 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -3037,9 +3037,9 @@

     def _fully_retrieved_data_dicts(self, resultdata):
         """Yield items of self._previous_dicts that are not in resultdata."""
-        resuldata_titles = {d['title'] for d in resultdata}
+        resultdata_titles = {d['title'] for d in resultdata if 'title' in d}
         for prev_title, prev_dict in self._previous_dicts.copy().items():
-            if prev_title not in resuldata_titles:
+            if prev_title not in resultdata_titles:
                 yield prev_dict
                 del self._previous_dicts[prev_title]


--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/609491
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Id0bb248af1333fff88857c0e61c21f0602e0ebf4
Gerrit-Change-Number: 609491
Gerrit-PatchSet: 5
Gerrit-Owner: Russell Blau <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Merlijn van Deen <[email protected]>
Gerrit-Reviewer: Multichill <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits

Reply via email to