Permalink
Browse files

retries should be warnings

  • Loading branch information...
1 parent 8793e51 commit 5734b9f0e7b46152d8bca1865a88ca34524875fc @jamesturk committed Jun 7, 2017
Showing with 5 additions and 5 deletions.
  1. +5 −5 scrapelib/__init__.py
View
@@ -20,12 +20,8 @@
_user_agent = ' '.join(('scrapelib', __version__, requests.utils.default_user_agent()))
-class NullHandler(logging.Handler):
- def emit(self, record):
- pass
-
_log = logging.getLogger('scrapelib')
-_log.addHandler(NullHandler())
+_log.addHandler(logging.NullHandler())
class HTTPMethodUnavailableError(requests.RequestException):
@@ -175,6 +171,10 @@ def request(self, method, url, retry_on_404=False, **kwargs):
# twice as long each time
wait = (self.retry_wait_seconds * (2 ** (tries - 1)))
_log.debug('sleeping for %s seconds before retry' % wait)
+ if exception_raised:
+ _log.warn('got %s sleeping for %s seconds before retry', exception_raised, wait)
+ else:
+ _log.warn('sleeping for %s seconds before retry', wait)
time.sleep(wait)
# out of the loop, either an exception was raised or we had a success

0 comments on commit 5734b9f

Please sign in to comment.