本文整理汇总了Python中aiohttp.client.HttpClient._resurrect_failed方法的典型用法代码示例。如果您正苦于以下问题:Python HttpClient._resurrect_failed方法的具体用法?Python HttpClient._resurrect_failed怎么用?Python HttpClient._resurrect_failed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类aiohttp.client.HttpClient
的用法示例。
在下文中一共展示了HttpClient._resurrect_failed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_resurrect_failed_all
# 需要导入模块: from aiohttp.client import HttpClient [as 别名]
# 或者: from aiohttp.client.HttpClient import _resurrect_failed [as 别名]
def test_resurrect_failed_all(self, asyncio):
now = int(time.time())
c = HttpClient(
[('localhost', 1000), ('localhost', 1000)], resolve=False)
c._hosts = []
c._failed.append((('localhost', 1000), now - 10))
c._failed.append((('localhost', 1001), now - 10))
c._resurrect_failed()
self.assertEqual(
c._hosts, [('localhost', 1000), ('localhost', 1001)])
self.assertFalse(
asyncio.get_event_loop.return_value.call_later.called)
示例2: test_resurrect_failed
# 需要导入模块: from aiohttp.client import HttpClient [as 别名]
# 或者: from aiohttp.client.HttpClient import _resurrect_failed [as 别名]
def test_resurrect_failed(self):
now = int(time.time())
loop = unittest.mock.Mock()
c = HttpClient(
[('localhost', 1000), ('localhost', 1000)], loop=loop)
c._hosts = []
c._failed.append((('localhost', 1000), now - 10))
c._failed.append((('localhost', 1001), now - 10))
c._failed.append((('localhost', 1002), now + 10))
c._resurrect_failed()
self.assertEqual(
c._hosts, [('localhost', 1000), ('localhost', 1001)])
self.assertTrue(loop.call_later.called)