本文整理汇总了Python中twisted.web.client.HTTPConnectionPool.timeout方法的典型用法代码示例。如果您正苦于以下问题:Python HTTPConnectionPool.timeout方法的具体用法?Python HTTPConnectionPool.timeout怎么用?Python HTTPConnectionPool.timeout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twisted.web.client.HTTPConnectionPool
的用法示例。
在下文中一共展示了HTTPConnectionPool.timeout方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _HTTP11ClientFactoryPatched
# 需要导入模块: from twisted.web.client import HTTPConnectionPool [as 别名]
# 或者: from twisted.web.client.HTTPConnectionPool import timeout [as 别名]
_requestDeferred.addCallbacks(cbRequestWrotten, ebRequestWriting)
return self._finishedRequest
class _HTTP11ClientFactoryPatched(_HTTP11ClientFactory):
def buildProtocol(self, addr):
proto = HTTP11ClientProtocolPatched(self._quiescentCallback)
proto.timeout = 2 #self.timeout
return proto
pool = HTTPConnectionPool(reactor, True)
pool._factory = _HTTP11ClientFactoryPatched
pool.timeout = 2
agent = Agent(reactor, connectTimeout = 2, pool = pool)
#agent = Agent(reactor)
d = agent.request(
'GET',
'http://192.168.1.141/test1/php/api.php',
Headers({'User-Agent': ['Twisted Web Client Example']}),
None)
#reactor.callLater(2, d.cancel)
def cbRequest(response):