DNS access

Jp Calderone exarkun at divmod.com
Wed Jul 13 22:06:06 CEST 2005

On Wed, 13 Jul 2005 15:22:35 -0400, Chris Lambacher <lambacck at computer.org> wrote:
>reverse dns lookup is not really special compared to a regular dns lookup.
>you just need to look up a special name:
>to format the ip address properly use something like:
>def rev_dns_string(ip_str):
>    nums = ip_str.split('.').reverse()
>    nums.extend(('in-addr', 'arpa'))
>    return '.'.join(nums)

It may not be special, but it is different.  Reverse DNS uses PTR records, not A records.  The site you referenced points this out, too:

Reverse DNS entries are set up with PTR records (whereas standard DNS uses A 
records), which look like " PTR host.example.com" 
(whereas standard DNS would look like "host.example.com. A").


More information about the Python-list mailing list