本文整理汇总了Python中twisted.names.dns.Record_TXT方法的典型用法代码示例。如果您正苦于以下问题:Python dns.Record_TXT方法的具体用法?Python dns.Record_TXT怎么用?Python dns.Record_TXT使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twisted.names.dns
的用法示例。
在下文中一共展示了dns.Record_TXT方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_txt
# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import Record_TXT [as 别名]
def test_txt(self):
"""
Two L{dns.Record_TXT} instances compare equal if and only if they have
the same data and ttl.
"""
# Vary the length of the data
self._equalityTest(
dns.Record_TXT('foo', 'bar', ttl=10),
dns.Record_TXT('foo', 'bar', ttl=10),
dns.Record_TXT('foo', 'bar', 'baz', ttl=10))
# Vary the value of the data
self._equalityTest(
dns.Record_TXT('foo', 'bar', ttl=10),
dns.Record_TXT('foo', 'bar', ttl=10),
dns.Record_TXT('bar', 'foo', ttl=10))
# Vary the ttl
self._equalityTest(
dns.Record_TXT('foo', 'bar', ttl=10),
dns.Record_TXT('foo', 'bar', ttl=10),
dns.Record_TXT('foo', 'bar', ttl=100))
示例2: test_hashable
# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import Record_TXT [as 别名]
def test_hashable(self):
"""
Instances of all record types are hashable.
"""
records = [
dns.Record_NS, dns.Record_MD, dns.Record_MF, dns.Record_CNAME,
dns.Record_MB, dns.Record_MG, dns.Record_MR, dns.Record_PTR,
dns.Record_DNAME, dns.Record_A, dns.Record_SOA, dns.Record_NULL,
dns.Record_WKS, dns.Record_SRV, dns.Record_AFSDB, dns.Record_RP,
dns.Record_HINFO, dns.Record_MINFO, dns.Record_MX, dns.Record_TXT,
dns.Record_AAAA, dns.Record_A6, dns.Record_NAPTR
]
for k in records:
k1, k2 = k(), k()
hk1 = hash(k1)
hk2 = hash(k2)
self.assertEquals(hk1, hk2, "%s != %s (for %s)" % (hk1,hk2,k))
示例3: test_TXT
# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import Record_TXT [as 别名]
def test_TXT(self):
"""Test DNS 'TXT' record queries"""
return self.namesTest(
self.resolver.lookupText('test-domain.com'),
[dns.Record_TXT(b'A First piece of Text', b'a SecoNd piece',
ttl=19283784),
dns.Record_TXT(b'Some more text, haha! Yes. \0 Still here?',
ttl=19283784)]
)
示例4: test_TXT
# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import Record_TXT [as 别名]
def test_TXT(self):
"""
The byte stream written by L{dns.Record_TXT.encode} can be used by
L{dns.Record_TXT.decode} to reconstruct the state of the original
L{dns.Record_TXT} instance.
"""
self._recordRoundtripTest(dns.Record_TXT(b'foo', b'bar'))
示例5: testTXT
# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import Record_TXT [as 别名]
def testTXT(self):
"""Test DNS 'TXT' record queries"""
return self.namesTest(
self.resolver.lookupText('test-domain.com'),
[dns.Record_TXT('A First piece of Text', 'a SecoNd piece', ttl=19283784),
dns.Record_TXT('Some more text, haha! Yes. \0 Still here?', ttl=19283784)]
)
示例6: test_spf
# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import Record_TXT [as 别名]
def test_spf(self):
"""
The repr of a L{dns.Record_SPF} instance includes the data and ttl
fields of the record, since it is structurally
similar to L{dns.Record_TXT}.
"""
self.assertEqual(
repr(dns.Record_SPF("foo", "bar", ttl=15)),
"<SPF data=['foo', 'bar'] ttl=15>")
示例7: testHashable
# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import Record_TXT [as 别名]
def testHashable(self):
records = [
dns.Record_NS, dns.Record_MD, dns.Record_MF, dns.Record_CNAME,
dns.Record_MB, dns.Record_MG, dns.Record_MR, dns.Record_PTR,
dns.Record_DNAME, dns.Record_A, dns.Record_SOA, dns.Record_NULL,
dns.Record_WKS, dns.Record_SRV, dns.Record_AFSDB, dns.Record_RP,
dns.Record_HINFO, dns.Record_MINFO, dns.Record_MX, dns.Record_TXT,
dns.Record_AAAA, dns.Record_A6
]
for k in records:
k1, k2 = k(), k()
hk1 = hash(k1)
hk2 = hash(k2)
self.assertEquals(hk1, hk2, "%s != %s (for %s)" % (hk1,hk2,k))