本文整理汇总了Python中twisted.names.dns.PTR属性的典型用法代码示例。如果您正苦于以下问题:Python dns.PTR属性的具体用法?Python dns.PTR怎么用?Python dns.PTR使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类twisted.names.dns
的用法示例。
在下文中一共展示了dns.PTR属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: lookupPointer
# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import PTR [as 别名]
def lookupPointer(self, name, timeout=None):
return self._lookup(name, dns.IN, dns.PTR, timeout)
示例2: test_lookupPointer
# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import PTR [as 别名]
def test_lookupPointer(self):
"""
See L{test_lookupAddress}
"""
d = client.lookupPointer(self.hostname)
d.addCallback(self.checkResult, dns.PTR)
return d
示例3: lookupPointer
# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import PTR [as 别名]
def lookupPointer(self, name, timeout = None):
"""
@see: twisted.names.client.lookupPointer
"""
return self._lookup(name, dns.IN, dns.PTR, timeout)
示例4: lookupPointer
# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import PTR [as 别名]
def lookupPointer(self, name, timeout = None):
return self._lookup(name, dns.IN, dns.PTR, timeout)
示例5: ipToHostname
# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import PTR [as 别名]
def ipToHostname(self, ad):
# Try to determine the hostname of the provided address.
# Returns a deferred, which will callback but never errback.
# If successful, the callback argument is a hostname string,
# None otherwise.
revip = '.'.join(str(ord(o)) for o in ad.getRawIP()[::-1])
host = "%s.in-addr.arpa" % revip
def cb(result):
try:
hostname = result[0][0].payload.name.name
if not hostname:
return None
except:
return None
return hostname
def eb(failure):
return None
d = self.resolver.query(dns.Query(host, type=dns.PTR))
d.addCallbacks(cb, eb)
return d
# Simplified lookup interface