Skip to content
Permalink
Browse files

renamed UserTimeoutError and ServerTimeouterror #583

  • Loading branch information
nramirezuy authored and dangra committed Aug 8, 2014
1 parent 2d103e0 commit 037f6abe8d1313985422522f6977397d833777a8
Showing with 11 additions and 11 deletions.
  1. +4 −4 scrapy/contrib/downloadermiddleware/retry.py
  2. +7 −7 scrapy/tests/test_downloadermiddleware_retry.py
@@ -18,9 +18,9 @@
indicate server overload, which would be something we want to retry
"""

from twisted.internet.defer import TimeoutError as UserTimeoutError
from twisted.internet.error import TimeoutError as ServerTimeoutError, \
DNSLookupError, ConnectionRefusedError, ConnectionDone, ConnectError, \
from twisted.internet import defer
from twisted.internet.error import TimeoutError, DNSLookupError, \
ConnectionRefusedError, ConnectionDone, ConnectError, \
ConnectionLost, TCPTimedOutError

from scrapy import log
@@ -33,7 +33,7 @@ class RetryMiddleware(object):

# IOError is raised by the HttpCompression middleware when trying to
# decompress an empty response
EXCEPTIONS_TO_RETRY = (ServerTimeoutError, UserTimeoutError, DNSLookupError,
EXCEPTIONS_TO_RETRY = (defer.TimeoutError, TimeoutError, DNSLookupError,
ConnectionRefusedError, ConnectionDone, ConnectError,
ConnectionLost, TCPTimedOutError, ResponseFailed,
IOError)
@@ -1,7 +1,8 @@
import unittest
from twisted.internet.error import TimeoutError as ServerTimeoutError, \
DNSLookupError, ConnectionRefusedError, ConnectionDone, ConnectError, \
ConnectionLost
from twisted.internet import defer
from twisted.internet.error import TimeoutError, DNSLookupError, \
ConnectionRefusedError, ConnectionDone, ConnectError, \
ConnectionLost, TCPTimedOutError

from scrapy import optional_features
from scrapy.contrib.downloadermiddleware.retry import RetryMiddleware
@@ -41,7 +42,6 @@ def test_dont_retry(self):

def test_dont_retry_exc(self):
req = Request('http://www.scrapytest.org/503', meta={'dont_retry': True})
rsp = Response('http://www.scrapytest.org/503', body='', status=503)

r = self.mw.process_exception(req, DNSLookupError(), self.spider)
assert r is None
@@ -64,9 +64,9 @@ def test_503(self):
assert self.mw.process_response(req, rsp, self.spider) is rsp

def test_twistederrors(self):
exceptions = [ServerTimeoutError, DNSLookupError,
ConnectionRefusedError, ConnectionDone, ConnectError,
ConnectionLost]
exceptions = [defer.TimeoutError, TCPTimedOutError, TimeoutError,
DNSLookupError, ConnectionRefusedError, ConnectionDone,
ConnectError, ConnectionLost]
if 'http11' in optional_features:
exceptions.append(ResponseFailed)

0 comments on commit 037f6ab

Please sign in to comment.
You can’t perform that action at this time.