Revision: 7159 Author: alexsh Date: 2009-08-16 18:01:30 +0000 (Sun, 16 Aug 2009)
Log Message: ----------- Handle API result ValueError
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2009-08-16 16:06:54 UTC (rev 7158) +++ trunk/pywikipedia/wikipedia.py 2009-08-16 18:01:30 UTC (rev 7159) @@ -1545,6 +1545,14 @@ if retry_delay > 30: retry_delay = 30 continue + except ValueError: # API result cannot decode + output(u"Server error encountered; will retry in %i minute%s." + % (retry_delay, retry_delay != 1 and "s" or "")) + time.sleep(60 * retry_delay) + retry_delay *= 2 + if retry_delay > 30: + retry_delay = 30 + continue # If it has gotten this far then we should reset dblagged dblagged = False # Check blocks
pywikipedia-svn@lists.wikimedia.org