当前位置: 首页>>代码示例>>Python>>正文


Python twisted.TwistedResolver方法代码示例

本文整理汇总了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. 
开发者ID:tao12345666333,项目名称:tornado-zh,代码行数:9,代码来源:netutil_test.py

示例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() 
开发者ID:tao12345666333,项目名称:tornado-zh,代码行数:32,代码来源:test_resolvers.py

示例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. 
开发者ID:opendevops-cn,项目名称:opendevops,代码行数:14,代码来源:netutil_test.py

示例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) 
开发者ID:viewfinderco,项目名称:viewfinder,代码行数:5,代码来源:netutil_test.py


注:本文中的tornado.platform.twisted.TwistedResolver方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。