当前位置: 首页>>代码示例>>Python>>正文


Python dns.Record_TXT方法代码示例

本文整理汇总了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)) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:22,代码来源:test_dns.py

示例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)) 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:20,代码来源:test_dns.py

示例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)]
        ) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:11,代码来源:test_names.py

示例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')) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:9,代码来源:test_dns.py

示例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)]
        ) 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:9,代码来源:test_names.py

示例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>") 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:11,代码来源:test_dns.py

示例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)) 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:17,代码来源:test_dns.py


注:本文中的twisted.names.dns.Record_TXT方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。