jenkins-bot has submitted this change and it was merged.
Change subject: MW 1.25wmf4 API deprecated paraminfo querymodules ......................................................................
MW 1.25wmf4 API deprecated paraminfo querymodules
The API action=paraminfo parameter querymodules has been deprecated with parameter modules as the alternative, with query+value as the replacement.
QueryGenerator updated to support both old and new syntax, depending on the site version.
Bug: 72169 Change-Id: Ic02dfba4fd94d8c69b7f28037330cd6467f30234 --- M pywikibot/data/api.py 1 file changed, 14 insertions(+), 7 deletions(-)
Approvals: Legoktm: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py index 95f6b91..5357cc5 100644 --- a/pywikibot/data/api.py +++ b/pywikibot/data/api.py @@ -908,22 +908,29 @@
@property def _modules(self): - """Query api on self.site for paraminfo on querymodule=self.module.""" - if not set(self.module.split('|')) <= set(self.__modules.keys()): + """Query api on self.site for paraminfo on self.module.""" + modules = self.module.split('|') + if not set(modules) <= set(self.__modules.keys()): + if LV(self.site.version()) < LV('1.25wmf4'): + key = 'querymodules' + value = self.module + else: + key = 'modules' + value = ['query+' + module for module in modules] paramreq = CachedRequest(expiry=config.API_config_expiry, site=self.site, action="paraminfo", - querymodules=self.module) + **{key: value}) data = paramreq.submit() assert "paraminfo" in data - assert "querymodules" in data["paraminfo"] - assert len(data["paraminfo"]["querymodules"]) == 1 + self.module.count("|") - for paraminfo in data["paraminfo"]["querymodules"]: + assert key in data["paraminfo"] + assert len(data["paraminfo"][key]) == len(modules) + for paraminfo in data["paraminfo"][key]: assert paraminfo["name"] in self.module if "missing" in paraminfo: raise Error("Invalid query module name '%s'." % self.module) self.__modules[paraminfo["name"]] = paraminfo _modules = {} - for m in self.module.split('|'): + for m in modules: _modules[m] = self.__modules[m] return _modules
pywikibot-commits@lists.wikimedia.org