本文整理匯總了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)