本文整理汇总了Python中treq.client.HTTPClient.with_config方法的典型用法代码示例。如果您正苦于以下问题:Python HTTPClient.with_config方法的具体用法?Python HTTPClient.with_config怎么用?Python HTTPClient.with_config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类treq.client.HTTPClient
的用法示例。
在下文中一共展示了HTTPClient.with_config方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from treq.client import HTTPClient [as 别名]
# 或者: from treq.client.HTTPClient import with_config [as 别名]
def setUp(self):
self.pool = HTTPConnectionPool(reactor, persistent=False)
self.client = HTTPClient.with_config(
pool=self.pool, allow_redirects=False, reactor=reactor)
self.resource = TxSyncMLResource(reactor)
self.site = server.Site(self.resource)
self.listener = reactor.listenTCP(0, self.site, interface='localhost')
self.listener_port = self.listener.getHost().port
self.fixtures = FixtureHelper()
self.addCleanup(self.listener.loseConnection)
self.addCleanup(self.pool.closeCachedConnections)
示例2: _client
# 需要导入模块: from treq.client import HTTPClient [as 别名]
# 或者: from treq.client.HTTPClient import with_config [as 别名]
def _client(*args, **kwargs):
return HTTPClient.with_config(**kwargs)
示例3: _client
# 需要导入模块: from treq.client import HTTPClient [as 别名]
# 或者: from treq.client.HTTPClient import with_config [as 别名]
def _client(*args, **kwargs):
kwargs['pool'] = default_pool(kwargs.get('reactor'),
kwargs.get('pool'),
kwargs.get('persistent'))
return HTTPClient.with_config(**kwargs)
示例4: __init__
# 需要导入模块: from treq.client import HTTPClient [as 别名]
# 或者: from treq.client.HTTPClient import with_config [as 别名]
def __init__(self, seeds=[('localhost', 4001)]):
self.nodes = set(seeds)
self.http_client = HTTPClient.with_config()