http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10709
Revision: 10709 Author: xqt Date: 2012-11-11 18:23:35 +0000 (Sun, 11 Nov 2012) Log Message: ----------- encodeTitle is not used by query.py
Modified Paths: -------------- trunk/pywikipedia/catlib.py trunk/pywikipedia/imageuncat.py trunk/pywikipedia/query.py trunk/pywikipedia/statistics_in_wikitable.py trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/catlib.py =================================================================== --- trunk/pywikipedia/catlib.py 2012-11-11 18:13:55 UTC (rev 10708) +++ trunk/pywikipedia/catlib.py 2012-11-11 18:23:35 UTC (rev 10709) @@ -675,7 +675,7 @@ 'cmtitle' :CatName, }
- data = query.GetData(params, site, encodeTitle = False) + data = query.GetData(params, site) categories_parsed.append(CatName) try: members = data['query']['categorymembers']
Modified: trunk/pywikipedia/imageuncat.py =================================================================== --- trunk/pywikipedia/imageuncat.py 2012-11-11 18:13:55 UTC (rev 10708) +++ trunk/pywikipedia/imageuncat.py 2012-11-11 18:23:35 UTC (rev 10709) @@ -7,17 +7,19 @@ __version__ = '$Id$' # # (C) Multichill 2008-2011 -# (C) Pywikipedia bot team, 2008-2011 +# (C) Pywikipedia bot team, 2008-2012 # # Distributed under the terms of the MIT license. # #
import os, sys, re, codecs -import wikipedia as pywikibot -import config, pagegenerators, query from datetime import datetime from datetime import timedelta +import wikipedia as pywikibot +import config +import pagegenerators +import query
#Probably unneeded because these are hidden categories. Have to figure it out. ignoreCategories = [u'Category:CC-BY-SA-3.0', @@ -1273,7 +1275,7 @@ 'rctype' :'edit|log', }
- data = query.GetData(params, site, encodeTitle = False) + data = query.GetData(params, site) try: for item in data['query']['recentchanges']: result.append(item['title'])
Modified: trunk/pywikipedia/query.py =================================================================== --- trunk/pywikipedia/query.py 2012-11-11 18:13:55 UTC (rev 10708) +++ trunk/pywikipedia/query.py 2012-11-11 18:23:35 UTC (rev 10709) @@ -14,7 +14,7 @@ 'rvprop' :'user|timestamp|content', }
- print query.GetData(params, encodeTitle = False) + print query.GetData(params)
""" # @@ -28,6 +28,7 @@ import time import wikipedia as pywikibot import config +from pywikibot import deprecate_arg try: #For Python 2.6 newer import json @@ -38,7 +39,7 @@ except ImportError: import simplejson as json
- +@deprecate_arg("encodeTitle", None) def GetData(params, site=None, useAPI=True, retryCount=config.maxretries, encodeTitle=True, sysop=False, back_response=False): """Get data from the query api, and convert it into a data object
Modified: trunk/pywikipedia/statistics_in_wikitable.py =================================================================== --- trunk/pywikipedia/statistics_in_wikitable.py 2012-11-11 18:13:55 UTC (rev 10708) +++ trunk/pywikipedia/statistics_in_wikitable.py 2012-11-11 18:23:35 UTC (rev 10709) @@ -62,7 +62,7 @@ } pywikibot.output("\nQuerying api for json-formatted data...") try: - data = query.GetData(params,self.site, encodeTitle = False) + data = query.GetData(params,self.site) except: url = self.site.protocol() + '://' + self.site.hostname() + self.site.api_address() pywikibot.output("The query has failed. Have you check the API? Cookies are working?")
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2012-11-11 18:13:55 UTC (rev 10708) +++ trunk/pywikipedia/wikipedia.py 2012-11-11 18:23:35 UTC (rev 10709) @@ -1316,7 +1316,7 @@ 'prop' :'info', 'titles' :self.title(), } - data = query.GetData(params, self.site(), encodeTitle = False)['query']['pages'].values()[0] + data = query.GetData(params, self.site)['query']['pages'].values()[0] if 'redirect' in data: raise IsRedirectPage elif 'missing' in data: @@ -1351,7 +1351,7 @@ tmpsFound = [] count = 0 while True: - data = query.GetData(params, self.site(), encodeTitle = False)['query']['pages'].values()[0] + data = query.GetData(params, self.site)['query']['pages'].values()[0] if "templates" not in data: return []
@@ -6841,7 +6841,7 @@
seen = set() while True: - data = query.GetData(params, self, encodeTitle = False) + data = query.GetData(params, self) if 'error' in data: raise RuntimeError('%s' % data['error']) try: @@ -7888,7 +7888,7 @@ 'rctoken' : 'patrol', 'rclimit' : 1, } - data = query.GetData(params, self, encodeTitle = False) + data = query.GetData(params, self) if 'error' in data: raise RuntimeError('%s' % data['error']) elif 'warnings' in data: @@ -7924,7 +7924,7 @@ 'list' :'allimages', 'aisha1' :hash_found, } - allimages = query.GetData(params, self, encodeTitle = False)['query']['allimages'] + allimages = query.GetData(params, self)['query']['allimages'] files = list() for imagedata in allimages: image = imagedata[u'name']