Search code examples
pythondnspython

How to use 'relativize' in dnspython but prevent replacing full names with '@'?


I am using the dnspython package. While processing a file and passing relativize=False in dnspython's from_file() function, each name of a record is displayed fully, (e.g. 'smtp.example.com.')

I prefer an overview which shows only "smtp" in case of that subdomain. This could be realized by using relativize=True in the from_file() function. However, in that case, all full DNS names ('example.com') are replaced by an @ (at symbol).

Can I configure dnspython to relativize subdomains, but show the full DNS name without only showing the @?


Solution

  • Symbol @ is used by DNS data format. See RFC1035 paragraph 5.1:

    A free standing @ is used to denote the current origin.

    So it is standard to use @ for current zone name. You can replace @ with zone (domain) name if it is needed. Though it is strange to mix relative and full domain names.