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/…
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/…
<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=quer…
<?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=quer…
<?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=q…
http://baseballpedia.shoutwiki.com/w/api.php?action=paraminfo&modules=q…
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.…
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