Home page

Use

dnspython is a DNS toolkit for Python. It supports almost all record types.
It can be used for queries, zone transfers, and dynamic updates. It supports
TSIG authenticated messages and EDNS0.

dnspython provides both high and low level access to DNS. The high level
classes perform queries for data of a given name, type, and class, and
return an answer set. The low level classes allow direct manipulation of
DNS zones, messages, names, and records.

importdns.queryimportdns.tsigkeyringimportdns.updateimportsysif__name__=='__main__':keyring=dns.tsigkeyring.from_text({'host-example.':'XXXXXXXXXXXXXXXXXXXXXX=='})# Replace an A recordupdate=dns.update.Update('example.com',keyring=keyring)update.replace('host',300,'a',sys.argv[1])response=dns.query.tcp(update,'10.0.0.1')

And there is more

There is more that can be done using this package please refer to
the documentation.