jayvdb created this task. jayvdb assigned this task to Omegat. jayvdb added subscribers: pywikipedia-bugs, jayvdb, XZise. jayvdb added projects: PyWikiBot-Interwiki-Map, pywikibot-core, Pywikibot-tests. jayvdb changed Security from none to none.
TASK DESCRIPTION The MediaWiki API has two modes of obtaining API parameter information.
The 'old way' was deprecated in WM API version '1.25wmf4' , forcing the dev team to write code to support the new mode, and make that the default for 1.25wmf4+
The test api_tests.TestParamInfo currently runs the 'new mode' tests against any wiki. We need to determine when the new mode was first added to the API, and not run this test for wikis that do not support it.
And, the documentation should be updated with information about the two modes and which versions use which modes: https://www.mediawiki.org/wiki/API:Parameter_information
TASK DETAIL https://phabricator.wikimedia.org/T77966
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
To: Omegat, jayvdb Cc: Aklapper, jayvdb, XZise, pywikipedia-bugs
Omegat added a comment.
It seems that the new mode was added in version 1.23. A version 1.22 site https://frack.nl/w/api.php?action=paraminfo&modules=query+info https://frack.nl/w/api.php?action=paraminfo&querymodules=info
A version 1.23 site http://barterempire.gamepedia.com/api.php?actions=paraminfo&modules=quer...
A version 1.24 site http://baseballpedia.shoutwiki.com/w/api.php?actions=paraminfo&modules=q...
For 1.23 and 1.24, the action parameter is unrecognized.. I dont know why though.. but the new method is working on 1.23 onwards.
Also, the documentation page needs to be updated but there's no mention of the new mode in it. I am not sure if I know everything to write the documentation for this page.
TASK DETAIL https://phabricator.wikimedia.org/T77966
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Omegat Cc: Aklapper, jayvdb, XZise, pywikipedia-bugs
XZise added a comment.
Your commands are wrong: You need to use `action=paraminfo`.
TASK DETAIL https://phabricator.wikimedia.org/T77966
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Omegat, XZise Cc: Aklapper, jayvdb, XZise, pywikipedia-bugs
gerritbot added a project: Patch-For-Review. gerritbot added a comment.
Change 181720 had a related patch set uploaded (by Maverick): Bug: https://phabricator.wikimedia.org/T77966 Skip test_new_mode if the mw version < 1.23. Bug: https://phabricator.wikimedia.org/T77966
https://gerrit.wikimedia.org/r/181720
https://phabricator.wikimedia.org/tag/patch-for-review/
TASK DETAIL https://phabricator.wikimedia.org/T77966
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Omegat, gerritbot Cc: Aklapper, jayvdb, XZise, pywikipedia-bugs
jayvdb added a subscriber: Omegat. jayvdb added a comment.
@omegat, as @xzise has said, your URLs are wrong. The MediaWiki API is just plain old HTTP. If you cant get it to work in a web browser, it will not work in pywikibot. 1.23.8 (*.gamepedia.com) does __not__ support the new mode.
1.23 ----
http://barterempire.gamepedia.com/api.php?action=query&meta=siteinfo
<?xml version="1.0"?> <api> <query> <general mainpage="Barter Empire Wiki" base="http://barterempire.gamepedia.com/Barter_Empire_Wiki" sitename="Barter Empire Wiki" logo="http://hydra-media.cursecdn.com/barterempire.gamepedia.com/b/bc/Wiki.png" generator="MediaWiki 1.23.8" phpversion="5.4.28-1+deb.sury.org~precise+1" phpsapi="fpm-fcgi" dbtype="mysql" dbversion="5.5.31-55" imagewhitelistenabled="" langconversion="" titleconversion="" linkprefixcharset="" linkprefix="" linktrail="/^([a-z]+)(.*)$/sD" git-hash="cf64e03e367f4ce136933709c86dcf9a75969a4b" case="first-letter" lang="en" fallback8bitEncoding="windows-1252" writeapi="" timezone="UTC" timeoffset="0" articlepath="/$1" scriptpath="" script="/index.php" server="http://barterempire.gamepedia.com" wikiid="barterempire_gamepedia" time="2014-12-24T07:58:36Z" maxuploadsize="104857600" favicon="http://hydra-media.cursecdn.com/barterempire.gamepedia.com/6/64/Favicon.ico"> <fallback /> <thumblimits> <limit>120</limit> <limit>150</limit> <limit>180</limit> <limit>200</limit> <limit>250</limit> <limit>300</limit> </thumblimits> <imagelimits> <limit width="320" height="240" /> <limit width="640" height="480" /> <limit width="800" height="600" /> <limit width="1024" height="768" /> <limit width="1280" height="1024" /> </imagelimits> </general> </query> </api>
http://barterempire.gamepedia.com/api.php?action=paraminfo&modules=query...
<?xml version="1.0"?> <api> <warnings> <paraminfo xml:space="preserve">Unrecognized value for parameter 'modules': query info</paraminfo> </warnings> <paraminfo> <modules /> </paraminfo> </api>
Using percent encoding of the + doesnt help:
http://barterempire.gamepedia.com/api.php?action=paraminfo&modules=query...
<?xml version="1.0"?> <api> <warnings> <paraminfo xml:space="preserve">Unrecognized value for parameter 'modules': query+info</paraminfo> </warnings> <paraminfo> <modules /> </paraminfo> </api>
And most importantly, the new mode test fails on this site, so it does not work on 1.23!
$ python pwb.py generate_family_file.py http://barterempire.gamepedia.com/ barterempire Generating family file from http://barterempire.gamepedia.com/
================================== api url: http://barterempire.gamepedia.com/api.php MediaWiki version: 1.23.8 ==================================
Determining other languages... Loading wikis... * en... in cache Writing pywikibot/families/barterempire_family.py... $ gedit user-config.py $ python -m unittest -v tests.api_tests.TestParamInfo max_retries reduced from 25 to 1 for tests test_generators (tests.api_tests.TestParamInfo) ... ok test_init (tests.api_tests.TestParamInfo) ... ok test_init_pageset (tests.api_tests.TestParamInfo) ... ok test_modules (tests.api_tests.TestParamInfo) Test v1.8 modules exist. ... ok test_multiple_modules (tests.api_tests.TestParamInfo) ... ok test_new_mode (tests.api_tests.TestParamInfo) ... WARNING: API warning (paraminfo): Unrecognized value for parameter 'modules': main FAIL test_old_mode (tests.api_tests.TestParamInfo) ... ok test_prefixes (tests.api_tests.TestParamInfo) Test v1.8 module prefixes exist. ... ok test_query_modules_with_limits (tests.api_tests.TestParamInfo) ... ok test_with_invalid_module (tests.api_tests.TestParamInfo) ... WARNING: API warning (paraminfo): Unrecognized value for parameter 'modules': foobar ok test_with_module_info (tests.api_tests.TestParamInfo) ... ok test_with_module_revisions (tests.api_tests.TestParamInfo) ... ok
====================================================================== FAIL: test_new_mode (tests.api_tests.TestParamInfo) ---------------------------------------------------------------------- Traceback (most recent call last): File "tests/api_tests.py", line 233, in test_new_mode pi.fetch(['info']) File "pywikibot/data/api.py", line 268, in fetch self._init() File "pywikibot/data/api.py", line 202, in _init main_modules_param = self.parameter('main', 'action') File "pywikibot/data/api.py", line 379, in parameter self.fetch(set([module])) File "pywikibot/data/api.py", line 281, in fetch assert(self._query_modules or _init) AssertionError
---------------------------------------------------------------------- Ran 12 tests in 12.518s
1..24 -----
It also does not work on 1.24
$ python pwb.py generate_family_file.py http://baseballpedia.shoutwiki.com/ baseballpedia Generating family file from http://baseballpedia.shoutwiki.com/
================================== api url: http://baseballpedia.shoutwiki.com/w/api.php MediaWiki version: 1.24.1 ==================================
Determining other languages... Loading wikis... * ru... in cache Writing pywikibot/families/baseballpedia_family.py...
$ python -m unittest -v tests.api_tests.TestParamInfo max_retries reduced from 25 to 1 for tests test_generators (tests.api_tests.TestParamInfo) ... ok test_init (tests.api_tests.TestParamInfo) ... ok test_init_pageset (tests.api_tests.TestParamInfo) ... ok test_modules (tests.api_tests.TestParamInfo) Test v1.8 modules exist. ... ok test_multiple_modules (tests.api_tests.TestParamInfo) ... ok test_new_mode (tests.api_tests.TestParamInfo) ... WARNING: API warning (paraminfo): Unrecognized value for parameter 'modules': main FAIL test_old_mode (tests.api_tests.TestParamInfo) ... ok test_prefixes (tests.api_tests.TestParamInfo) Test v1.8 module prefixes exist. ... ok test_query_modules_with_limits (tests.api_tests.TestParamInfo) ... ok test_with_invalid_module (tests.api_tests.TestParamInfo) ... WARNING: API warning (paraminfo): Unrecognized value for parameter 'modules': foobar ok test_with_module_info (tests.api_tests.TestParamInfo) ... ok test_with_module_revisions (tests.api_tests.TestParamInfo) ... ok
====================================================================== FAIL: test_new_mode (tests.api_tests.TestParamInfo) ---------------------------------------------------------------------- Traceback (most recent call last): File "tests/api_tests.py", line 233, in test_new_mode pi.fetch(['info']) File "pywikibot/data/api.py", line 268, in fetch self._init() File "pywikibot/data/api.py", line 202, in _init main_modules_param = self.parameter('main', 'action') File "pywikibot/data/api.py", line 379, in parameter self.fetch(set([module])) File "pywikibot/data/api.py", line 281, in fetch assert(self._query_modules or _init) AssertionError
---------------------------------------------------------------------- Ran 12 tests in 14.438s
FAILED (failures=1)
http://baseballpedia.shoutwiki.com/w/api.php?action=paraminfo&modules=qu... http://baseballpedia.shoutwiki.com/w/api.php?action=paraminfo&modules=qu...
1.25 ----
It does work on the WMF projects, because they are running 1.25.
https://en.wikipedia.org/w/api.php?action=paraminfo&modules=query%2Binfo
Here is the change which introduced the new mode.
https://gerrit.wikimedia.org/r/#/c/160798/
The WMF team has not added it to the release notes on the wiki
https://www.mediawiki.org/wiki/MediaWiki_1.25
But it is mentioned in their release notes in Git.
https://git.wikimedia.org/blob/mediawiki%2Fcore.git/master/RELEASE-NOTES-1.2...
TASK DETAIL https://phabricator.wikimedia.org/T77966
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Omegat, jayvdb Cc: Aklapper, jayvdb, XZise, Omegat, pywikipedia-bugs
gerritbot added a comment.
Change 181720 had a related patch set uploaded (by Maverick): Bug: https://phabricator.wikimedia.org/T77966 Skip test_new_mode if the mw version < 1.25. Bug: https://phabricator.wikimedia.org/T77966
https://gerrit.wikimedia.org/r/181720
https://phabricator.wikimedia.org/tag/patch-for-review/
TASK DETAIL https://phabricator.wikimedia.org/T77966
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Omegat, gerritbot Cc: Aklapper, jayvdb, XZise, Omegat, pywikipedia-bugs
Liuxinyu970226 added a subscriber: Liuxinyu970226.
TASK DETAIL https://phabricator.wikimedia.org/T77966
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Omegat, Liuxinyu970226 Cc: Aklapper, jayvdb, XZise, Omegat, Liuxinyu970226, pywikipedia-bugs
jayvdb added a comment.
Before submitting more incorrect patches, lets discuss the problems here on Phab until you've found a solution that works correctly.
do you know if the version "1.25wmf1" supports the new mode?
'wmf1' is the same as 'alpha', so you can test wmf1 using any of these wikis.
https://wikiapiary.com/wiki/Generator:MediaWiki_1.25alpha
Report the results of the tests here on Phab.
TASK DETAIL https://phabricator.wikimedia.org/T77966
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Omegat, jayvdb Cc: Aklapper, jayvdb, XZise, Omegat, Liuxinyu970226, pywikipedia-bugs
Omegat added a comment.
Yes the new_mode is supported by 1.25alpha. BetaWiki on IWM runs on 1.25alpha and works. https://translatewiki.net/w/api.php?action=paraminfo&modules=query+info
http://www.traba.org/wikitraba/api.php?action=paraminfo&modules=query+in... works with the new mode too.
TASK DETAIL https://phabricator.wikimedia.org/T77966
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Omegat Cc: Aklapper, jayvdb, XZise, Omegat, Liuxinyu970226, pywikipedia-bugs
jayvdb added a comment.
Ok, so 'alpha' is more complicated than 'equals wmf1'
Here are two '1.25alpha' which fail
https://secure.unrelated.net.au/wiki/api.php?action=paraminfo&modules=qu...
http://aniwiki.net/api.php?action=paraminfo&modules=query+info
'alpha' is a version string that is initially 'equals wmf1' , but if the wiki is using git, they can be using code which is more recent, and the version string will still be 'alpha'.
e.g.
https://secure.unrelated.net.au/wiki/api.php?action=query&meta=siteinfo says it is using git-hash="https://phabricator.wikimedia.org/rMW1a239219eebbb53b42d63cb27c20cf0c9a75680..." git-branch="master"
http://git.wikimedia.org/tree/mediawiki%2Fcore.git/1a239219eebbb53b42d63cb27... was dated 2014-09-22
and
http://aniwiki.net/api.php?action=query&meta=siteinfo says it is using git-hash="https://phabricator.wikimedia.org/rMW8aaf4468411b77b3bff93302f8da5815744673f..." git-branch="master"
http://git.wikimedia.org/tree/mediawiki%2Fcore.git/8aaf4468411b77b3bff93302f... is dated 2014-10-01
https://www.mediawiki.org/wiki/MediaWiki_1.25/wmf3 says wmf3 was released 2014-10-09
As this is quite complicated to detect which wmf version this appeared on, the answer is 1.25wmf4. The new mode feature was added in https://gerrit.wikimedia.org/r/#/c/160798/ , and the old mode was deprecated in the same change.
TASK DETAIL https://phabricator.wikimedia.org/T77966
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Omegat, jayvdb Cc: Aklapper, jayvdb, XZise, Omegat, Liuxinyu970226, pywikipedia-bugs
gerritbot added a comment.
Change 181720 had a related patch set uploaded (by Maverick): Skip test_new_mode if the mw version < 1.25wmf4.
https://gerrit.wikimedia.org/r/181720
https://phabricator.wikimedia.org/tag/patch-for-review/
TASK DETAIL https://phabricator.wikimedia.org/T77966
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Omegat, gerritbot Cc: Aklapper, jayvdb, XZise, Omegat, Liuxinyu970226, pywikipedia-bugs
jayvdb changed the title from "Determine when the new mode of paraminfo became available" to "Skip the paraminfo new mode test on sites which do not support the new mode".
TASK DETAIL https://phabricator.wikimedia.org/T77966
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Omegat, jayvdb Cc: Aklapper, jayvdb, XZise, Omegat, Liuxinyu970226, pywikipedia-bugs
gerritbot added a comment.
Change 181720 merged by jenkins-bot: Skip test_new_mode if the mw version < 1.25wmf4
https://gerrit.wikimedia.org/r/181720
TASK DETAIL https://phabricator.wikimedia.org/T77966
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Omegat, gerritbot Cc: Aklapper, jayvdb, XZise, Omegat, Liuxinyu970226, pywikipedia-bugs
jayvdb closed this task as "Resolved".
TASK DETAIL https://phabricator.wikimedia.org/T77966
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Omegat, jayvdb Cc: Aklapper, jayvdb, XZise, Omegat, Liuxinyu970226, pywikipedia-bugs
Liuxinyu970226 removed a subscriber: Liuxinyu970226.
TASK DETAIL https://phabricator.wikimedia.org/T77966
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Omegat, Liuxinyu970226 Cc: Aklapper, jayvdb, XZise, Omegat, pywikipedia-bugs
pywikipedia-bugs@lists.wikimedia.org