Revision: 6016 Author: filnik Date: 2008-10-25 11:32:44 +0000 (Sat, 25 Oct 2008)
Log Message: ----------- A little fix in the newimages() function, now the error returned is ServerError and not KeyError, when the server is down
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2008-10-24 18:29:39 UTC (rev 6015) +++ trunk/pywikipedia/wikipedia.py 2008-10-25 11:32:44 UTC (rev 6016) @@ -5080,7 +5080,10 @@
data = query.GetData(params, useAPI = True, encodeTitle = False) - imagesData = data['query']['logevents'] + try: + imagesData = data['query']['logevents'] + except KeyError: + raise ServerError("The APIs don't return the data, the site may be down") while True: for imageData in imagesData: try: