jenkins-bot has submitted this change and it was merged.
Change subject: Fix notifications query parse
......................................................................
Fix notifications query parse
In meta=notifications, query.notifications.list was changed to an
actual list, so we should only call values() on it if we're
allowed to. The API change can be viewed at
https://phabricator.wikimedia.org/rECHOb10bd700333d2eef10c7df0a9946b87fd451…
Bug: T138690
Change-Id: I30c9fbd7cc6002106430d1c26a1e3d2d7e8caa65
---
M pywikibot/site.py
1 file changed, 8 insertions(+), 2 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py
index ce7f628..f8c6996 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -2283,8 +2283,14 @@
params['not' + key] = kwargs[key]
data = self._simple_request(**params).submit()
- for notif in
data['query']['notifications']['list'].values():
- yield Notification.fromJSON(self, notif)
+ notifications = data['query']['notifications']['list']
+
+ # Support API before 1.27.0-wmf.22
+ if hasattr(notifications, 'values'):
+ notifications = notifications.values()
+
+ for notification in notifications:
+ yield Notification.fromJSON(self, notification)
@need_extension('Echo')
def notifications_mark_read(self, **kwargs):
--
To view, visit
https://gerrit.wikimedia.org/r/295567
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I30c9fbd7cc6002106430d1c26a1e3d2d7e8caa65
Gerrit-PatchSet: 12
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: APerson <danielhglus(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Sn1per <geofbot(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>