Page MenuHomePhabricator

Old help module raises an exception
Closed, ResolvedPublic

Description

Calling the help module on older generators results in a pywikibot APIError exception.

http://wiki.linuxgaming.de/api.php?action=help&modules=help&format=json (MW 1.14)

{"error":{"code":"help","info":"","*":"\n  \n  \n  ******************************************************************\n  **                                                              **\n  **  This is an auto-generated MediaWiki API documentation page  **\n  ** ...."}}
>>> s = pywikibot.Site('de', 'lgde')
>>> r = pywikibot.data.api.Request(site=s, action='help', modules='help')
>>> r.submit()
Found 1 lgde:de processes running, including this one.
API Error: query=
{'action': [u'help'],
 'format': ['json'],
 'maxlag': ['5'],
 'modules': [u'help']}
           response=....
'}}
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "pywikibot/data/api.py", line 1361, in submit
    raise APIError(code, info, **result["error"])
APIError: help:

Note that the modules param for module help doesnt work in MW 1.14

Event Timeline

jayvdb raised the priority of this task from to Needs Triage.
jayvdb updated the task description. (Show Details)
jayvdb added a project: Pywikibot.
jayvdb subscribed.
Restricted Application added subscribers: Aklapper, Unknown Object (MLST). · View Herald TranscriptMar 19 2015, 12:00 PM

See also T93188 and my question also applies to this one. In fact the APIError seems reasonable, because action=help doesn't exist pre 1.25 as http://wiki.linuxgaming.de/api.php?action=help&modules=foo&format=json returns exactly the same message. So by that standard it should throw the exception in post 1.25 (wrt T93188).

action=help is a valid module since .. well a very long time ago. https://www.mediawiki.org/wiki/API:Help
It does work as expected in 1.19 (wikia) and 1.24 (https://docs.moodle.org/19/fr/api.php)

>>> s = pywikibot.Site('wikia', 'wikia')
>>> r = pywikibot.data.api.Request(site=s, action='help', modules='help')
>>> r.submit()
{u'help': [u'* action=help *\n  Display this help screen. Or the help screen for the specified module\nParameters:\n  modules             - List of module names (value of the action= parameter)\n  querymodules        - List of query module names (value of prop=, meta= or list= parameter)\nExamples:\n  Whole help page:\n    api.php?action=help\n  Module (action) help page:\n    api.php?action=help&modules=protect\n  Query (list) modules help page:\n    api.php?action=help&querymodules=categorymembers\n  Query (prop) modules help page:\n    api.php?action=help&querymodules=info\n  Query (meta) modules help page:\n    api.php?action=help&querymodules=siteinfo\nHelp pages:\n  https://www.mediawiki.org/wiki/API:Main_page\n  https://www.mediawiki.org/wiki/API:FAQ\n  https://www.mediawiki.org/wiki/API:Quick_start_guide\n']}

>>> import pywikibot
>>> s = pywikibot.Site('fr', 'moodle')
>>> r = pywikibot.data.api.Request(site=s, action='help', modules='help')
>>> r.submit()
{u'help': [u"* action=help *\n  Display this help screen. Or the help screen for the specified module.\n  https://www.mediawiki.org/wiki/API:Main_page\n  https://www.mediawiki.org/wiki/API:FAQ\n  https://www.mediawiki.org/wiki/API:Quick_start_guide\nParameters:\n  modules             - List of module names (value of the action= parameter). Can specify submodules with a '+'\n                        Separate values with '|'\n                        Maximum number of values 50 (500 for bots)\n  querymodules        - DEPRECATED! Use modules=query+value instead. List of query module names (value of prop=, meta= or list= parameter)\n                        Separate values with '|'\n                        Maximum number of values 50 (500 for bots)\nExamples:\n  Whole help page:\n    api.php?action=help\n  Module (action) help page:\n    api.php?action=help&modules=protect\n  Help for the query/categorymembers module:\n    api.php?action=help&modules=query+categorymembers\n  Help for the login and query/info modules:\n    api.php?action=help&modules=login|query+info\n"]}

Oh interesting. But that is then a bug of the MW and not pywikibot.

yea, but we need to handle it, as it exists in at least 1.11 and 1.14. And those releases are not maintained, so the bug will never be fixed. Anyway, I have a fix for this and T93188 coming.

Change 197903 had a related patch set uploaded (by John Vandenberg):
API help support complete help

https://gerrit.wikimedia.org/r/197903

Change 197903 merged by jenkins-bot:
API help support complete help

https://gerrit.wikimedia.org/r/197903

jayvdb claimed this task.