本文整理汇总了Python中twisted.names.dns.TXT属性的典型用法代码示例。如果您正苦于以下问题:Python dns.TXT属性的具体用法?Python dns.TXT怎么用?Python dns.TXT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类twisted.names.dns
的用法示例。
在下文中一共展示了dns.TXT属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: lookupText
# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import TXT [as 别名]
def lookupText(self, name, timeout=None):
return self._lookup(name, dns.IN, dns.TXT, timeout)
示例2: test_lookupText
# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import TXT [as 别名]
def test_lookupText(self):
"""
See L{test_lookupAddress}
"""
d = client.lookupText(self.hostname)
d.addCallback(self.checkResult, dns.TXT)
return d
示例3: lookupDataViaTXT
# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import TXT [as 别名]
def lookupDataViaTXT(domain, prefix=""):
_initResolver()
lookup = "{}.{}".format(prefix, domain,) if prefix else domain
log.debug("DNS TXT: lookup: {l}", l=lookup)
try:
answers = (yield DebugResolver.lookupText(lookup))[0]
except (DomainError, AuthoritativeDomainError), e:
log.debug("DNS TXT: lookup failed: {exc}", exc=e)
answers = ()
示例4: stripComments
# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import TXT [as 别名]
def stripComments(self, lines):
"""
Work around a bug in the base implementation that causes parsing of TXT RRs with
a ; in the RDATA to fail because the ; is treated as the start of a comment. Here
we simply ignore all comments.
"""
return [
(a.find(';') == -1 or "TXT" in a) and a or a[:a.find(';')] for a in [
b.strip() for b in lines
]
]
示例5: parseLines
# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import TXT [as 别名]
def parseLines(self, lines):
"""
Work around a bug in the base implementation that causes parsing of TXT RRs with
spaces in the RDATA to be broken into multiple fragments and for quotes around the
data to not be removed.
"""
for line in lines:
if line[3] == "TXT":
line[4] = " ".join(line[4:])[1:-1]
del line[5:]
BindAuthority.parseLines(self, lines)
示例6: lookupText
# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import TXT [as 别名]
def lookupText(self, name, timeout = None):
"""
@see: twisted.names.client.lookupText
"""
return self._lookup(name, dns.IN, dns.TXT, timeout)
示例7: lookupText
# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import TXT [as 别名]
def lookupText(self, name, timeout = None):
return self._lookup(name, dns.IN, dns.TXT, timeout)
示例8: query
# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import TXT [as 别名]
def query(self):
d = self.resolver.query(
dns.Query(self.hostname, type=dns.TXT))
def cb(result):
# Convert DNS reply into a simple list of strings.
return [a.payload.data[0] for a in result[0]]
d.addCallback(cb)
return d