http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10274
Revision: 10274 Author: valhallasw Date: 2012-06-03 08:18:49 +0000 (Sun, 03 Jun 2012) Log Message: ----------- Basic query.py compatibility script; this will allow for quickly transferring old scripts to the rewrite.
Added Paths: ----------- branches/rewrite/pywikibot/compat/ branches/rewrite/pywikibot/compat/__init__.py branches/rewrite/pywikibot/compat/query.py
Added: branches/rewrite/pywikibot/compat/__init__.py =================================================================== Added: branches/rewrite/pywikibot/compat/query.py =================================================================== --- branches/rewrite/pywikibot/compat/query.py (rev 0) +++ branches/rewrite/pywikibot/compat/query.py 2012-06-03 08:18:49 UTC (rev 10274) @@ -0,0 +1,19 @@ +import pywikibot +from pywikibot.data import api +from pywikibot import deprecated + +@deprecated("pywikibot.data.api.Request") +def GetData(request, site=None, back_response=False): + if site: + request['site'] = site + + req = api.Request(**request) + result = req.submit() + + if back_response: + pywikibot.warning(u"back_response is no longer supported; an empty response object will be returned") + import StringIO + res_dummy = StringIO.StringIO() + res_dummy.__dict__.update({u'code': 0, u'msg': u''}) + return res_dummy, result + return result