當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。