Revision: 5241 Author: nicdumz Date: 2008-04-20 10:01:57 +0000 (Sun, 20 Apr 2008)
Log Message: ----------- * Some verbosity when setuptools is not installed * Correcting calls to wait() / .retry_wait in Request
Modified Paths: -------------- branches/rewrite/pywikibot/comms/threadedhttp.py branches/rewrite/pywikibot/data/api.py
Modified: branches/rewrite/pywikibot/comms/threadedhttp.py =================================================================== --- branches/rewrite/pywikibot/comms/threadedhttp.py 2008-04-19 19:56:10 UTC (rev 5240) +++ branches/rewrite/pywikibot/comms/threadedhttp.py 2008-04-20 10:01:57 UTC (rev 5241) @@ -28,9 +28,14 @@
import urllib import cookielib +import sys
# easy_install safeguarded dependencies -import pkg_resources +try: + import pkg_resources +except ImportError: + print "Error : You need the python module setuptools to use this module" + sys.exit(1) pkg_resources.require("httplib2") import httplib2
Modified: branches/rewrite/pywikibot/data/api.py =================================================================== --- branches/rewrite/pywikibot/data/api.py 2008-04-19 19:56:10 UTC (rev 5240) +++ branches/rewrite/pywikibot/data/api.py 2008-04-20 10:01:57 UTC (rev 5241) @@ -177,7 +177,7 @@ "Non-JSON response received from server %s; the server may be down." % self.site) print rawdata - self.wait(max_retries, retry_wait) + self.wait() continue if not result: result = {} @@ -221,7 +221,7 @@ self.max_retries -= 1 if self.max_retries < 0: raise TimeoutError("Maximum retries attempted without success.") - logging.warn("Waiting %s seconds before retrying." % wait) + logging.warn("Waiting %s seconds before retrying." % self.retry_wait) time.sleep(self.retry_wait) # double the next wait, but do not exceed 120 seconds self.retry_wait = min(120, self.retry_wait * 2)