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: ~dns.name.Name | str | None = None, rdclass: ~dns.rdataclass.RdataClass = RdataClass.IN, keyring: ~typing.Any | None = None, keyname: ~dns.name.Name | None = None, keyalgorithm: ~dns.name.Name | str = <DNS name hmac-sha256.>, id: int | None = 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: Name | str, rdtype: RdataType | str | None = None) 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: Name | str, *args: Any) None[source]

Add records.

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

  • rdataset…

  • ttl, rdata…

  • ttl, rdtype, string…

delete(name: Name | str, *args: Any) None[source]

Delete records.

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

  • empty

  • rdataset…

  • rdata…

  • rdtype, [string…]

property prerequisite: List[RRset]

The prerequisite section.

present(name: Name | str, *args: Any) None[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: Name | str, *args: Any) None[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.

property update: List[RRset]

The update section.

property zone: List[RRset]

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

Update sections

dns.update.PREREQ = UpdateSection.PREREQ

Update sections

dns.update.UPDATE = UpdateSection.UPDATE

Update sections

dns.update.ADDITIONAL = UpdateSection.ADDITIONAL

Update sections