本文整理匯總了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