本文整理汇总了Python中tornado.netutil.ThreadedResolver.resolve方法的典型用法代码示例。如果您正苦于以下问题:Python ThreadedResolver.resolve方法的具体用法?Python ThreadedResolver.resolve怎么用?Python ThreadedResolver.resolve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tornado.netutil.ThreadedResolver
的用法示例。
在下文中一共展示了ThreadedResolver.resolve方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ThreadedResolver
# 需要导入模块: from tornado.netutil import ThreadedResolver [as 别名]
# 或者: from tornado.netutil.ThreadedResolver import resolve [as 别名]
from tornado.ioloop import IOLoop
from tornado.netutil import ThreadedResolver
# When this module is imported, it runs getaddrinfo on a thread. Since
# the hostname is unicode, getaddrinfo attempts to import encodings.idna
# but blocks on the import lock. Verify that ThreadedResolver avoids
# this deadlock.
resolver = ThreadedResolver()
IOLoop.current().run_sync(lambda: resolver.resolve(u'localhost', 80))