當前位置: 首頁>>代碼示例>>Python>>正文


Python dns.PTR屬性代碼示例

本文整理匯總了Python中twisted.names.dns.PTR屬性的典型用法代碼示例。如果您正苦於以下問題:Python dns.PTR屬性的具體用法?Python dns.PTR怎麽用?Python dns.PTR使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在twisted.names.dns的用法示例。


在下文中一共展示了dns.PTR屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: lookupPointer

# 需要導入模塊: from twisted.names import dns [as 別名]
# 或者: from twisted.names.dns import PTR [as 別名]
def lookupPointer(self, name, timeout=None):
        return self._lookup(name, dns.IN, dns.PTR, timeout) 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:4,代碼來源:common.py

示例2: test_lookupPointer

# 需要導入模塊: from twisted.names import dns [as 別名]
# 或者: from twisted.names.dns import PTR [as 別名]
def test_lookupPointer(self):
        """
        See L{test_lookupAddress}
        """
        d = client.lookupPointer(self.hostname)
        d.addCallback(self.checkResult, dns.PTR)
        return d 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:9,代碼來源:test_client.py

示例3: lookupPointer

# 需要導入模塊: from twisted.names import dns [as 別名]
# 或者: from twisted.names.dns import PTR [as 別名]
def lookupPointer(self, name, timeout = None):
        """
        @see: twisted.names.client.lookupPointer
        """
        return self._lookup(name, dns.IN, dns.PTR, timeout) 
開發者ID:kuri65536,項目名稱:python-for-android,代碼行數:7,代碼來源:common.py

示例4: lookupPointer

# 需要導入模塊: from twisted.names import dns [as 別名]
# 或者: from twisted.names.dns import PTR [as 別名]
def lookupPointer(self, name, timeout = None):
        return self._lookup(name, dns.IN, dns.PTR, timeout) 
開發者ID:kenorb-contrib,項目名稱:BitTorrent,代碼行數:4,代碼來源:common.py

示例5: ipToHostname

# 需要導入模塊: from twisted.names import dns [as 別名]
# 或者: from twisted.names.dns import PTR [as 別名]
def ipToHostname(self, ad):
        # Try to determine the hostname of the provided address.
        # Returns a deferred, which will callback but never errback.
        # If successful, the callback argument is a hostname string,
        # None otherwise.

        revip = '.'.join(str(ord(o)) for o in ad.getRawIP()[::-1])
        host = "%s.in-addr.arpa" % revip

        def cb(result):
            try:
                hostname = result[0][0].payload.name.name
                if not hostname:
                    return None
            except:
                return None

            return hostname

        def eb(failure):
            return None

        d = self.resolver.query(dns.Query(host, type=dns.PTR))
        d.addCallbacks(cb, eb)
        return d


# Simplified lookup interface 
開發者ID:ffledgling,項目名稱:dtella,代碼行數:30,代碼來源:reverse_dns.py


注:本文中的twisted.names.dns.PTR屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。