[Pywikipedia-svn] SVN: [7314] trunk/pywikipedia/query.py

alexsh at svn.wikimedia.org alexsh at svn.wikimedia.org
Fri Sep 25 15:01:19 UTC 2009


Revision: 7314
Author:   alexsh
Date:     2009-09-25 15:01:19 +0000 (Fri, 25 Sep 2009)

Log Message:
-----------
query.GetData(): Raise ServerError when wikimedia server error occur.

Modified Paths:
--------------
    trunk/pywikipedia/query.py

Modified: trunk/pywikipedia/query.py
===================================================================
--- trunk/pywikipedia/query.py	2009-09-25 14:45:27 UTC (rev 7313)
+++ trunk/pywikipedia/query.py	2009-09-25 15:01:19 UTC (rev 7314)
@@ -111,6 +111,9 @@
                 return json.loads( jsontext )
 
         except ValueError, error:
+            if 'Wikimedia Error' in jsontext: #wikimedia server error
+                raise wikipedia.ServerError
+            
             retryCount -= 1
             wikipedia.output(u"Error downloading data: %s" % error)
             wikipedia.output(u"Request %s:%s" % (site.lang, path))





More information about the Pywikipedia-svn mailing list