Revision: 7244 Author: alexsh Date: 2009-09-13 22:48:01 +0000 (Sun, 13 Sep 2009)
Log Message: ----------- Site()._load(): raise API version limited to 1.14 cause uiprop=`preferencestoken` only available in 1.14 or newer
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2009-09-13 21:48:33 UTC (rev 7243) +++ trunk/pywikipedia/wikipedia.py 2009-09-13 22:48:01 UTC (rev 7244) @@ -5209,6 +5209,8 @@ if self._rights[index] is not None: # Token and rights are loaded - user data is now loaded self._userData[index] = True + #elif self.versionnumber() < 14: + # # uiprop 'preferencestoken' is start from 1.14, if 1.8~13, we need to use other way to get token else: if not self._isBlocked[index]: output(u'WARNING: Token not found on %s. You will not be able to edit any page.' % self) @@ -5474,13 +5476,17 @@
# Get data # API Userinfo is available from version 1.11 - if config.use_api and self.versionnumber() >= 11: + # preferencetoken available from 1.14 + if config.use_api and self.versionnumber() >= 14: #Query userinfo params = { 'action': 'query', 'meta': 'userinfo', 'uiprop': 'blockinfo|groups|rights|hasmsg|ratelimits|preferencestoken', } + #if self.versionnumber() >= 14: + # params['uiprop'] += '|preferencestoken' + text = query.GetData(params, self, sysop=sysop)['query']['userinfo'] ##output('%s' % text) # for debug use only else:
pywikipedia-svn@lists.wikimedia.org