本文整理汇总了Python中tornado.platform.twisted.TwistedResolver方法的典型用法代码示例。如果您正苦于以下问题:Python twisted.TwistedResolver方法的具体用法?Python twisted.TwistedResolver怎么用?Python twisted.TwistedResolver使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tornado.platform.twisted
的用法示例。
在下文中一共展示了twisted.TwistedResolver方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from tornado.platform import twisted [as 别名]
# 或者: from tornado.platform.twisted import TwistedResolver [as 别名]
def setUp(self):
super(CaresResolverTest, self).setUp()
self.resolver = CaresResolver(io_loop=self.io_loop)
# TwistedResolver produces consistent errors in our test cases so we
# can test the regular and error cases in the same class.
示例2: main
# 需要导入模块: from tornado.platform import twisted [as 别名]
# 或者: from tornado.platform.twisted import TwistedResolver [as 别名]
def main():
args = parse_command_line()
if not args:
args = ['localhost', 'www.google.com',
'www.facebook.com', 'www.dropbox.com']
resolvers = [Resolver(), ThreadedResolver()]
if twisted is not None:
from tornado.platform.twisted import TwistedResolver
resolvers.append(TwistedResolver())
if pycares is not None:
from tornado.platform.caresresolver import CaresResolver
resolvers.append(CaresResolver())
family = {
'unspec': socket.AF_UNSPEC,
'inet': socket.AF_INET,
'inet6': socket.AF_INET6,
}[options.family]
for host in args:
print('Resolving %s' % host)
for resolver in resolvers:
addrinfo = yield resolver.resolve(host, 80, family)
print('%s: %s' % (resolver.__class__.__name__,
pprint.pformat(addrinfo)))
print()
示例3: setUp
# 需要导入模块: from tornado.platform import twisted [as 别名]
# 或者: from tornado.platform.twisted import TwistedResolver [as 别名]
def setUp(self):
super(CaresResolverTest, self).setUp()
self.resolver = CaresResolver()
# TwistedResolver produces consistent errors in our test cases so we
# could test the regular and error cases in the same class. However,
# in the error cases it appears that cleanup of socket objects is
# handled asynchronously and occasionally results in "unclosed socket"
# warnings if not given time to shut down (and there is no way to
# explicitly shut it down). This makes the test flaky, so we do not
# test error cases here.
示例4: setUp
# 需要导入模块: from tornado.platform import twisted [as 别名]
# 或者: from tornado.platform.twisted import TwistedResolver [as 别名]
def setUp(self):
super(TwistedResolverTest, self).setUp()
self.resolver = TwistedResolver(io_loop=self.io_loop)