mediawiki-gateway
mediawiki-gateway copied to clipboard
mediawiki-1.25 API incompatibility
I have a mediawiki-gateway based bot that I'd like to run on http://ru.wikipedia.org/ - last time I tried it on about ~2013-12, and it was ok back then, but nowadays I always get the following error:
D, [2014-10-09T08:05:41.453869 #30170] DEBUG -- : GET:
{"action"=>"query", "prop"=>"info", "intoken"=>"edit",
"titles"=>"User:WebAnalyticsBot/testing", "format"=>"xml",
"maxlag"=>5}, {"ruwikiSession"=>"466dfb2ce72418b74400629b25975cc0",
"GeoIP"=>"RU%3AMoscow%3A55.7522%3A37.6156%3Av4", "Path"=>"%2F",
"Domain"=>".wikipedia.org", "centralauth_User"=>"WebAnalyticsBot",
"domain"=>".wikipedia.org", "centralauth_Token"=>"...",
"centralauth_Session"=>"...", "forceHTTPS"=>"true",
"ruwikiUserID"=>"1084957", "ruwikiUserName"=>"WebAnalyticsBot"}
D, [2014-10-09T08:05:41.741127 #30170] DEBUG -- : RES:
<api><warnings><info xml:space='preserve'>The intoken parameter has
been deprecated.</info></warnings><query><normalized><n
from='User:WebAnalyticsBot/testing'
to='User:WebAnalyticsBot/testing'/></normalized><pages><page
contentmodel='wikitext' counter=''
edittoken='a03becb45126ea2136e40e3f7cc2e1e2+\' lastrevid='60065217'
length='2' ns='2' pageid='4652026' pagelanguage='ru'
starttimestamp='2014-10-09T04:05:41Z'
title='User:WebAnalyticsBot/testing'
touched='2013-12-12T18:01:51Z'/></pages></query></api>
/var/lib/gems/2.1.0/gems/mediawiki-gateway-0.6.2/lib/media_wiki/gateway.rb:1071:in
`warning': API error: code 'warning', info 'API warning: The intoken
parameter has been deprecated.' (MediaWiki::APIError)
Basically, it seems that mediawiki-gateway tries to use
action=query&prop=info&intoken=edit
stuff, which seems to be
deprecated now:
* prop=info (in) * Get basic page information such as namespace, title, last touched date, ... https://www.mediawiki.org/wiki/API:Properties#info_.2F_in [...] intoken - DEPRECATED! Request a token to perform a data-modifying action on a page
It's probably a fairly vital issue, as it makes mediawiki-gateway totally unusable in current Wikipedia's installation environments, at least out of the box.
As far as I understand, it's not necessary to request a token, it would be given out automatically anyway in modern Mediawiki installations - probably this could be simply fixed by removing intoken=
setting.
@blackwinter suggested to try ignoring warnings by :ignorewarnings => true
in MediaWiki::Gateway.new
- I confirm that it works around the issue.
Thanks for filing this issue.
For the record: The MediaWiki version used by Wikipedia (currently 1.25wmf1) is bleeding edge and not publicly released yet. The underlying change, however, has even greater ramifications (wikimedia/mediawiki-core@fdddf94) and will be released in 1.24, scheduled for next month.
Thanks for checking the Mediawiki version history for me. Wow, I never thought that Wikipedia devops are so bold to live off the bleeding edge in production %)
For better or worse, MediaWiki is Wikipedia, and they've been running those unreleased "wmf" versions for years.
Related to #76.
@blackwinter suggested to try ignoring warnings by :ignorewarnings => true in MediaWiki::Gateway.new - I confirm that it works around the issue.
Is it still necessary to use this workaround?
Here's another warning from MW 1.25, raised by MediaWiki::Gateway::Users#options
.
MediaWiki::APIError: API error: code 'warning', info 'API warning: action=tokens has been deprecated. Please use action=query&meta=tokens instead.'
This is not going to get fixed unless somebody sends in a pull request.
Also, given that WMF has now released an "official" client at https://github.com/wikimedia/mediawiki-ruby-api, I will likely be deprecating this library entirely soon.
.. given that WMF has now released an "official" client .. I will likely be deprecating this library entirely ..
Makes sense, thanks.