Revision: 7118 Author: alexsh Date: 2009-08-06 11:08:52 +0000 (Thu, 06 Aug 2009)
Log Message: ----------- wikipedia.py: Put API version lock. according [[mw:API:Query]] information (some API query is not necessary because they start from 1.9)
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2009-08-06 10:45:42 UTC (rev 7117) +++ trunk/pywikipedia/wikipedia.py 2009-08-06 11:08:52 UTC (rev 7118) @@ -5133,7 +5133,7 @@
retry_idle_time = 1 while True: - if config.use_api: + if config.use_api and self.versionnumber() >= 12: params = { 'action':'query', 'meta':'allmessages', @@ -5718,7 +5718,7 @@ break
def randompage(self): - if config.use_api: + if config.use_api and self.versionnumber() >= 12: params = { 'action': 'query', 'list': 'random', @@ -5736,7 +5736,7 @@ return Page(self, m.group('title'))
def randomredirectpage(self): - if config.use_api: + if config.use_api and self.versionnumber() >= 12: params = { 'action': 'query', 'list': 'random', @@ -5980,7 +5980,7 @@ urlsToRetrieve = [siteurl] if not siteurl.startswith('*.'): urlsToRetrieve.append('*.' + siteurl) - if config.use_api: + if config.use_api and self.versionnumber() >= 11: output(u'Querying API exturlusage...') for url in urlsToRetrieve: params = { @@ -6593,6 +6593,9 @@
NOTE 2: it returns the image WITHOUT the image namespace. """ + if self.versionnumber() < 12: + return None + if hash_found is None: # If the hash is none return None and not continue return None # Now get all the images with the same hash