[Pywikipedia-l] SVN: [5666] trunk/pywikipedia/wikipedia.py
filnik at svn.wikimedia.org
filnik at svn.wikimedia.org
Thu Jul 3 19:18:50 UTC 2008
Revision: 5666
Author: filnik
Date: 2008-07-03 19:18:50 +0000 (Thu, 03 Jul 2008)
Log Message:
-----------
Little fix IndexError -> KeyError for getLatestUploader()
Modified Paths:
--------------
trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py 2008-07-03 09:36:23 UTC (rev 5665)
+++ trunk/pywikipedia/wikipedia.py 2008-07-03 19:18:50 UTC (rev 5666)
@@ -2634,7 +2634,7 @@
nick = data['query']['pages'][pageid][u'imageinfo'][0][u'user']
timestamp = data['query']['pages'][pageid][u'imageinfo'][0][u'timestamp']
return [nick, timestamp]
- except IndexError:
+ except KeyError:
raise NoPage(u'API Error, nothing found in the APIs')
def getHash(self):
@@ -2653,7 +2653,7 @@
pageid = data['query']['pages'].keys()[0]
try:
hash_found = data['query']['pages'][pageid][u'imageinfo'][0][u'sha1']
- except KeyError:
+ except (KeyError, IndexError):
if self.exists():
raise NoHash('No Hash found in the APIs! Maybe the regex to catch it is wrong or someone has changed the APIs structure.')
else:
More information about the Pywikipedia-l
mailing list