當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。