The dns.update.UpdateMessage Class

The dns.update.UpdateMessage class is used for DNS Dynamic Update messages. It provides section access using the DNS Dynamic Update section names, and a variety of convenience methods for constructing dynamic updates.

class dns.update.UpdateMessage(zone=None, rdclass=<RdataClass.IN: 1>, keyring=None, keyname=None, keyalgorithm=<DNS name hmac-sha256.>, id=None)[source]

Initialize a new DNS Update object.

See the documentation of the Message class for a complete description of the keyring dictionary.

zone, a dns.name.Name, str, or None, the zone which is being updated. None should only be used by dnspython’s message constructors, as a zone is required for the convenience methods like add(), replace(), etc.

rdclass, an int or str, the class of the zone.

The keyring, keyname, and keyalgorithm parameters are passed to use_tsig(); see its documentation for details.

absent(name, rdtype=None)[source]

Require that an owner name (and optionally an rdata type) does not exist as a prerequisite to the execution of the update.

add(name, *args)[source]

Add records.

The first argument is always a name. The other arguments can be:

  • rdataset…
  • ttl, rdata…
  • ttl, rdtype, string…
delete(name, *args)[source]

Delete records.

The first argument is always a name. The other arguments can be:

  • empty
  • rdataset…
  • rdata…
  • rdtype, [string…]
prerequisite

The prerequisite section.

present(name, *args)[source]

Require that an owner name (and optionally an rdata type, or specific rdataset) exists as a prerequisite to the execution of the update.

The first argument is always a name. The other arguments can be:

  • rdataset…
  • rdata…
  • rdtype, string…
replace(name, *args)[source]

Replace records.

The first argument is always a name. The other arguments can be:

  • rdataset…
  • ttl, rdata…
  • ttl, rdtype, string…

Note that if you want to replace the entire node, you should do a delete of the name followed by one or more calls to add.

update

The update section.

zone

The zone section.

The following constants may be used to specify sections in the find_rrset() and get_rrset() methods:

dns.update.ZONE = <UpdateSection.ZONE: 0>

Update sections

dns.update.PREREQ = <UpdateSection.PREREQ: 1>

Update sections

dns.update.UPDATE = <UpdateSection.UPDATE: 2>

Update sections

dns.update.ADDITIONAL = <UpdateSection.ADDITIONAL: 3>

Update sections