Revision: 6362 Author: filnik Date: 2009-02-18 12:49:54 +0000 (Wed, 18 Feb 2009)
Log Message: ----------- Bugfix due a change in the APIs -.-
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2009-02-18 12:49:45 UTC (rev 6361) +++ trunk/pywikipedia/wikipedia.py 2009-02-18 12:49:54 UTC (rev 6362) @@ -2878,6 +2878,28 @@ output(u'Image deleted before getting the Hash. Skipping...') return None
+ def getDuplicates(self): + #action=query&titles=File:Ayasegawa.jpg&prop=duplicatefiles + """ + Function that detects if a user is currently blocked or not. + """ + params = { + 'action' :'query', + 'titles' : self.title(), + 'prop' :'duplicatefiles', + } + + data = query.GetData(params, + useAPI = True, encodeTitle = False) + pageid = data[u'query'][u'pages'].keys()[0] + duplicates = list() + try: + for duplicateData in data[u'query'][u'pages'][pageid][u'duplicatefiles']: + duplicates.append(duplicateData[u"name"]) + return duplicates + except KeyError: + return None + def getFileVersionHistoryTable(self): """Return the version history in the form of a wiki table.""" lines = [] @@ -6217,11 +6239,11 @@ } data = query.GetData(params, site = getSite(self.lang, self.family), useAPI = True, encodeTitle = False) allimages = data['query']['allimages'] - duplicates = list() + files = list() for imagedata in allimages: image = imagedata[u'name'] - duplicates.append(image) - return duplicates + files.append(image) + return files
# Caches to provide faster access _sites = {}