Python twisted.internet.error 模块,TCPTimedOutError() 实例源码

我们从Python开源项目中,提取了以下5个代码示例,用于说明如何使用twisted.internet.error.TCPTimedOutError()

项目:scrapy_redis_splash_spider    作者:lymlhhj123    | 项目源码 | 文件源码
def error_back(self, failure):
        #request????error_back
        #???????request?????????????????
        #???????dns???????
        #???????????redis???????
        if failure.check(HttpError):
            #?????200?????
            response = failure.value.response
            self.logger.error('[%s] GET [%d]', response.url, response.status)

        if failure.check(DNSLookupError):
            #dns????
            request = failure.request
            self.logger.error('[%s] DNSLookupError', request.url)

        if failure.check(TimeoutError, TCPTimedOutError):
            #????
            request = failure.request
            self.logger.error('[%s] TimeoutError', request.url)
项目:scrapy_redis_spider    作者:lymlhhj123    | 项目源码 | 文件源码
def error_back(self, failure):
        #request????error_back
        #???????request?????????????????
        #???????dns???????
        #???????????redis???????

        if failure.check(HttpError):
            #?????200?????
            response = failure.value.response
            self.logger.error('[%s] GET [%d]', response.url, response.status)

        if failure.check(DNSLookupError):

            #dns????
            request = failure.request
            self.logger.error('[%s] DNSLookupError', request.url)

        if failure.check(TimeoutError, TCPTimedOutError):

            #????
            request = failure.request
            self.logger.error('[%s] TimeoutError', request.url)
项目:video_url_crawler_demo    作者:czs0x55aa    | 项目源码 | 文件源码
def errback_httpbin(self, failure):
        # log all failures
        self.logger.error(repr(failure))

        # in case you want to do something special for some errors,
        # you may need the failure's type:
        if failure.check(HttpError):
            # these exceptions come from HttpError spider middleware
            # you can get the non-200 response
            response = failure.value.response
            self.logger.error('HttpError on %s', response.url)

        elif failure.check(DNSLookupError):
            # this is the original request
            request = failure.request
            self.logger.error('DNSLookupError on %s', request.url)

        elif failure.check(TimeoutError, TCPTimedOutError):
            request = failure.request
            self.logger.error('TimeoutError on %s', request.url)
项目:scrapy_redis_spider    作者:lymlhhj123    | 项目源码 | 文件源码
def process_exception(self, request, exception, spider):
        #???????????????????request??????
        #???????????????

        #????????????????????????????????????
        if isinstance(exception, DNSLookupError):           
            self.crawler.signals.send_catch_log(dnslookuperror, spider=spider)

        if isinstance(exception, (TimeoutError, TCPTimedOutError)):         
            self.crawler.signals.send_catch_log(timeouterror, spider=spider)

        return request
项目:zenchmarks    作者:squeaky-pl    | 项目源码 | 文件源码
def test_errno(self):
        """
        L{error.getConnectError} converts based on errno for C{socket.error}.
        """
        self.assertErrnoException(errno.ENETUNREACH, error.NoRouteError)
        self.assertErrnoException(errno.ECONNREFUSED, error.ConnectionRefusedError)
        self.assertErrnoException(errno.ETIMEDOUT, error.TCPTimedOutError)
        if platformType == "win32":
            self.assertErrnoException(errno.WSAECONNREFUSED, error.ConnectionRefusedError)
            self.assertErrnoException(errno.WSAENETUNREACH, error.NoRouteError)