I just wanted to put() a simple page on a MediaWiki 1.16 instance, where I have to use screen scraping (use_api=False).
There is something strange however:
There is an API call invoked by _getBlocked:
/w/api.php?action=query&format=json&meta=userinfo&uiprop=blockinfo
Here's my backtrace:
File "pywikipedia/wikipedia.py", line 693, in get expandtemplates = expandtemplates)
File "pywikipedia/wikipedia.py", line 743, in _getEditPage return self._getEditPageOld(get_redirect, throttle, sysop, oldid, change_edit_time)
File "pywikipedia/wikipedia.py", line 854, in _getEditPageOld text = self.site().getUrl(path, sysop = sysop)
File "pywikipedia/wikipedia.py", line 5881, in getUrl self._getUserDataOld(text, sysop = sysop)
File "pywikipedia/wikipedia.py", line 6016, in _getUserDataOld blocked = self._getBlock(sysop = sysop)
File "pywikipedia/wikipedia.py", line 5424, in _getBlock data = query.GetData(params, self)
File "pywikipedia/query.py", line 146, in GetData jsontext = site.getUrl( path, retry=True, sysop=sysop, data=data)
getUrl(), which is also called from API, seems always to call _getUserDataOld(text) where text is ... API output so it tries to do strange things on that and gives warnings like
Note: this language does not allow global bots. WARNING: Token not found on wikipedia:pl. You will not be able to edit any page.
which is nonsense since the analyzed text is not HTML - only API output.
If getUrl() is supposed to be a low-level call, why call _getUserDataOld() there?
http://www.mediawiki.org/wiki/Special:Code/pywikipedia/7461
has introduced this call there.
It's easily reproducable by this:
import wikipedia import config config.use_api = False wikipedia.verbose = True s = wikipedia.getSite("pl", "wikipedia") p = wikipedia.Page(s, u"User:Saper") c = p.get() c += "<!-- test -->" p.put(c, u"Testing wiki", botflag=False)
//Saper
Hi Marcin,
Sorry for the late response.
On 7 October 2012 21:24, Marcin Cieslak saper@saper.info wrote:
If getUrl() is supposed to be a low-level call, why call _getUserDataOld() there?
You are completely right this shouldn't be there. I've created a bug report [1] for it and have marked the revision as 'fixme', indicating there is a problem with it.
Merlijn
[1] https://sourceforge.net/tracker/?group_id=93107&atid=603140
pywikipedia-l@lists.wikimedia.org