Rdata Subclass Reference

Universal Types

class dns.rdata.GenericRdata(rdclass, rdtype, data)[source]

Generic Rdata Class

This class is used for rdata types for which we have no better implementation. It implements the DNS “unknown RRs” scheme.

data

A bytes containing the rdata’s value.

class dns.rdtypes.ANY.AFSDB.AFSDB(rdclass, rdtype, preference, exchange)[source]

AFSDB record

property hostname

the AFSDB hostname

property subtype

the AFSDB subtype

class dns.rdtypes.ANY.AMTRELAY.AMTRELAY(rdclass, rdtype, precedence, discovery_optional, relay_type, relay)[source]

AMTRELAY record

precedence

An int, the 8-bit unsigned integer preference.

discovery_optional

A bool, specifying whether discovery is optional or not.

relay_type

An int, the 8-bit unsigned integer relay type.

relay

A dns.rdtypes.ANY.AMTRELAY.Relay instance, the relay.

to_text(origin=None, relativize=True, **kw)[source]

Convert an rdata to text format.

Returns a str.

class dns.rdtypes.ANY.AVC.AVC(rdclass: RdataClass, rdtype: RdataType, strings: Iterable[bytes | str])[source]

AVC record

strings

A tuple of bytes, the list of strings.

class dns.rdtypes.ANY.CAA.CAA(rdclass, rdtype, flags, tag, value)[source]

CAA (Certification Authority Authorization) record

flags

An int, the flags

tag

A bytes, the tag

value

A bytes, the value

to_text(origin=None, relativize=True, **kw)[source]

Convert an rdata to text format.

Returns a str.

class dns.rdtypes.ANY.CDNSKEY.CDNSKEY(rdclass, rdtype, flags, protocol, algorithm, key)[source]

CDNSKEY record

flags

An int, the key’s flags.

protocol

An int, the protocol for which this key may be used.

algorithm:

An int, the algorithm used for the key.

key

A bytes, the public key.

class dns.rdtypes.ANY.CDS.CDS(rdclass, rdtype, key_tag, algorithm, digest_type, digest)[source]

CDS record

key_tag

An int, the key tag.

algorithm

An int, the algorithm used for the key.

digest_type

An int, the digest type.

digest

A bytes, the digest of the key.

class dns.rdtypes.ANY.CERT.CERT(rdclass, rdtype, certificate_type, key_tag, algorithm, certificate)[source]

CERT record

certificate_type

An int, the certificate type.

key_tag

An int, the key tag.

algorithm

An int, the algorithm.

certificate

A bytes, the certificate or CRL.

to_text(origin=None, relativize=True, **kw)[source]

Convert an rdata to text format.

Returns a str.

class dns.rdtypes.ANY.CNAME.CNAME(rdclass, rdtype, target)[source]

CNAME record

Note: although CNAME is officially a singleton type, dnspython allows non-singleton CNAME rdatasets because such sets have been commonly used by BIND and other nameservers for load balancing.

target

A dns.name.Name, the target name.

class dns.rdtypes.ANY.CSYNC.CSYNC(rdclass, rdtype, serial, flags, windows)[source]

CSYNC record

serial

An int, the SOA serial number.

flags

An int, the CSYNC flags.

windows

A tuple of (int, bytes) tuples.

to_text(origin=None, relativize=True, **kw)[source]

Convert an rdata to text format.

Returns a str.

class dns.rdtypes.ANY.DLV.DLV(rdclass, rdtype, key_tag, algorithm, digest_type, digest)[source]

DLV record

key_tag

An int, the key tag.

algorithm

An int, the algorithm used for the key.

digest_type

An int, the digest type.

digest

A bytes, the digest of the key.

class dns.rdtypes.ANY.DNAME.DNAME(rdclass, rdtype, target)[source]

DNAME record

target

A dns.name.Name, the target name.

class dns.rdtypes.ANY.DNSKEY.DNSKEY(rdclass, rdtype, flags, protocol, algorithm, key)[source]

DNSKEY record

flags

An int, the key’s flags.

protocol

An int, the protocol for which this key may be used.

algorithm:

An int, the algorithm used for the key.

key

A bytes, the public key.

class dns.rdtypes.ANY.DS.DS(rdclass, rdtype, key_tag, algorithm, digest_type, digest)[source]

DS record

key_tag

An int, the key tag.

algorithm

An int, the algorithm used for the key.

digest_type

An int, the digest type.

digest

A bytes, the digest of the key.

class dns.rdtypes.ANY.EUI48.EUI48(rdclass, rdtype, eui)[source]

EUI48 record

eui

A bytes, 48-bit Extended Unique Identifier (EUI-48).

class dns.rdtypes.ANY.EUI64.EUI64(rdclass, rdtype, eui)[source]

EUI64 record

eui

A bytes, 64-bit Extended Unique Identifier (EUI-64).

class dns.rdtypes.ANY.GPOS.GPOS(rdclass, rdtype, latitude, longitude, altitude)[source]

GPOS record

latitude

A bytes, the latitude

longitude

A bytes, the longitude

altitude

A bytes, the altitude

property float_altitude

altitude as a floating point value

property float_latitude

latitude as a floating point value

property float_longitude

longitude as a floating point value

to_text(origin=None, relativize=True, **kw)[source]

Convert an rdata to text format.

Returns a str.

class dns.rdtypes.ANY.HINFO.HINFO(rdclass, rdtype, cpu, os)[source]

HINFO record

cpu

A bytes, the CPU type.

os

A bytes, the OS type.

to_text(origin=None, relativize=True, **kw)[source]

Convert an rdata to text format.

Returns a str.

class dns.rdtypes.ANY.HIP.HIP(rdclass, rdtype, hit, algorithm, key, servers)[source]

HIP record

hit

A bytes, the host identity tag.

algorithm

An int, the public key cryptographic algorithm.

key

A bytes, the public key.

servers

A tuple of dns.name.Name objects, the rendezvous servers.

to_text(origin=None, relativize=True, **kw)[source]

Convert an rdata to text format.

Returns a str.

class dns.rdtypes.ANY.ISDN.ISDN(rdclass, rdtype, address, subaddress)[source]

ISDN record

address

A bytes, the ISDN address.

subaddress

A bytes the ISDN subaddress (or b'' if not present).

to_text(origin=None, relativize=True, **kw)[source]

Convert an rdata to text format.

Returns a str.

class dns.rdtypes.ANY.L32.L32(rdclass, rdtype, preference, locator32)[source]

L32 record

preference

An int, the preference value.

locator32

A string, the 32-bit locator value in the form of an IPv4 address.

to_text(origin=None, relativize=True, **kw)[source]

Convert an rdata to text format.

Returns a str.

class dns.rdtypes.ANY.L64.L64(rdclass, rdtype, preference, locator64)[source]

L64 record

preference

An int, the preference value.

locator64

A string, the 64-bit locator value in colon-separated-hex form.

to_text(origin=None, relativize=True, **kw)[source]

Convert an rdata to text format.

Returns a str.

class dns.rdtypes.ANY.LOC.LOC(rdclass, rdtype, latitude, longitude, altitude, size=100.0, hprec=1000000.0, vprec=1000.0)[source]

LOC record

latitude

An (int, int, int, int, int) tuple specifying the degrees, minutes, seconds, milliseconds, and sign of the latitude.

longitude

An (int, int, int, int, int) tuple specifying the degrees, minutes, seconds, milliseconds, and sign of the longitude.

altitude

A float, the altitude, in centimeters.

size

A float, the size of the sphere, in centimeters.

horizontal_precision

A float, the horizontal precision, in centimeters.

vertical_precision

A float, the vertical precision, in centimeters.

property float_latitude

latitude as a floating point value

property float_longitude

longitude as a floating point value

to_text(origin=None, relativize=True, **kw)[source]

Convert an rdata to text format.

Returns a str.

class dns.rdtypes.ANY.LP.LP(rdclass, rdtype, preference, fqdn)[source]

LP record

preference

An int, the preference value.

fqdn

A dns.name.Name, the domain name of a locator.

to_text(origin=None, relativize=True, **kw)[source]

Convert an rdata to text format.

Returns a str.

class dns.rdtypes.ANY.MX.MX(rdclass, rdtype, preference, exchange)[source]

MX record

preference

An int, the preference value.

exchange

A dns.name.Name, the exchange name.

class dns.rdtypes.ANY.NID.NID(rdclass, rdtype, preference, nodeid)[source]

NID record

preference

An int, the preference value.

nodeid

A string, the 64-bit nodeid value in colon-separated-hex form.

to_text(origin=None, relativize=True, **kw)[source]

Convert an rdata to text format.

Returns a str.

class dns.rdtypes.ANY.NINFO.NINFO(rdclass: RdataClass, rdtype: RdataType, strings: Iterable[bytes | str])[source]

NINFO record

strings

A tuple of bytes, the list of strings.

class dns.rdtypes.ANY.NS.NS(rdclass, rdtype, target)[source]

NS record

target

A dns.name.Name, the target name.

class dns.rdtypes.ANY.NSEC.NSEC(rdclass, rdtype, next, windows)[source]

NSEC record

next

A dns.name.Name, the next name

windows

A tuple of (int, bytes) tuples.

to_text(origin=None, relativize=True, **kw)[source]

Convert an rdata to text format.

Returns a str.

class dns.rdtypes.ANY.NSEC3.NSEC3(rdclass, rdtype, algorithm, flags, iterations, salt, next, windows)[source]

NSEC3 record

algorithm:

An int, the algorithm used for the hash.

flags:

An int, the flags.

iterations:

An int, the number of iterations.

salt

A bytes, the salt.

next

A bytes, the next name hash.

windows

A tuple of (int, bytes) tuples.

to_text(origin=None, relativize=True, **kw)[source]

Convert an rdata to text format.

Returns a str.

class dns.rdtypes.ANY.NSEC3PARAM.NSEC3PARAM(rdclass, rdtype, algorithm, flags, iterations, salt)[source]

NSEC3PARAM record

algorithm:

An int, the algorithm used for the hash.

flags:

An int, the flags.

iterations:

An int, the number of iterations.

salt

A bytes, the salt.

to_text(origin=None, relativize=True, **kw)[source]

Convert an rdata to text format.

Returns a str.

class dns.rdtypes.ANY.OPENPGPKEY.OPENPGPKEY(rdclass, rdtype, key)[source]

OPENPGPKEY record

key

A bytes, the key.

to_text(origin=None, relativize=True, **kw)[source]

Convert an rdata to text format.

Returns a str.

class dns.rdtypes.ANY.PTR.PTR(rdclass, rdtype, target)[source]

PTR record

target

A dns.name.Name, the target name.

class dns.rdtypes.ANY.RESINFO.RESINFO(rdclass: RdataClass, rdtype: RdataType, strings: Iterable[bytes | str])[source]

RESINFO record

strings

A tuple of bytes, the list of strings.

class dns.rdtypes.ANY.RP.RP(rdclass, rdtype, mbox, txt)[source]

RP record

mbox

A dns.name.Name, the responsible person’s mailbox.

txt

A dns.name.Name, the owner name of a node with TXT records, or the root name if no TXT records are associated with this RP.

to_text(origin=None, relativize=True, **kw)[source]

Convert an rdata to text format.

Returns a str.

class dns.rdtypes.ANY.RRSIG.RRSIG(rdclass, rdtype, type_covered, algorithm, labels, original_ttl, expiration, inception, key_tag, signer, signature)[source]

RRSIG record

type_covered

An int, the rdata type this signature covers.

algorithm

An int, the algorithm used for the signature.

labels

An int, the number of labels.

original_ttl

An int, the original TTL.

expiration

An int, the signature expiration time.

inception

An int, the signature inception time.

key_tag

An int, the key tag.

signer

A dns.name.Name, the signer.

signature

A bytes, the signature.

covers()[source]

Return the type a Rdata covers.

DNS SIG/RRSIG rdatas apply to a specific type; this type is returned by the covers() function. If the rdata type is not SIG or RRSIG, dns.rdatatype.NONE is returned. This is useful when creating rdatasets, allowing the rdataset to contain only RRSIGs of a particular type, e.g. RRSIG(NS).

Returns a dns.rdatatype.RdataType.

to_text(origin=None, relativize=True, **kw)[source]

Convert an rdata to text format.

Returns a str.

class dns.rdtypes.ANY.RT.RT(rdclass, rdtype, preference, exchange)[source]

RT record

preference

An int, the preference value.

exchange

A dns.name.Name, the exchange name.

class dns.rdtypes.ANY.SMIMEA.SMIMEA(rdclass, rdtype, usage, selector, mtype, cert)[source]

SMIMEA record

usage

An int, the certificate usage.

selector

An int, the selector.

mtype

An int, the matching type.

cert

A bytes, the certificate association data.

class dns.rdtypes.ANY.SOA.SOA(rdclass, rdtype, mname, rname, serial, refresh, retry, expire, minimum)[source]

SOA record

mname

A dns.name.Name, the MNAME (master name).

rname

A dns.name.Name, the RNAME (responsible name).

serial

An int, the zone’s serial number.

refresh

An int, the zone’s refresh value (in seconds).

retry

An int, the zone’s retry value (in seconds).

expire

An int, the zone’s expiration value (in seconds).

minimum

An int, the zone’s negative caching time (in seconds, called “minimum” for historical reasons).

to_text(origin=None, relativize=True, **kw)[source]

Convert an rdata to text format.

Returns a str.

class dns.rdtypes.ANY.SPF.SPF(rdclass: RdataClass, rdtype: RdataType, strings: Iterable[bytes | str])[source]

SPF record

strings

A tuple of bytes, the list of strings.

class dns.rdtypes.ANY.SSHFP.SSHFP(rdclass, rdtype, algorithm, fp_type, fingerprint)[source]

SSHFP record

algorithm

An int, the algorithm.

fp_type

An int, the digest type.

fingerprint

A bytes, the fingerprint.

to_text(origin=None, relativize=True, **kw)[source]

Convert an rdata to text format.

Returns a str.

class dns.rdtypes.ANY.TLSA.TLSA(rdclass, rdtype, usage, selector, mtype, cert)[source]

TLSA record

usage

An int, the certificate usage.

selector

An int, the selector.

mtype

An int, the matching type.

cert

A bytes, the certificate association data.

class dns.rdtypes.ANY.TXT.TXT(rdclass: RdataClass, rdtype: RdataType, strings: Iterable[bytes | str])[source]

TXT record

strings

A tuple of bytes, the list of strings.

class dns.rdtypes.ANY.URI.URI(rdclass, rdtype, priority, weight, target)[source]

URI record

priority

An int, the priority.

weight

An int, the weight.

target

A dns.name.Name, the target.

to_text(origin=None, relativize=True, **kw)[source]

Convert an rdata to text format.

Returns a str.

class dns.rdtypes.ANY.WALLET.WALLET(rdclass: RdataClass, rdtype: RdataType, strings: Iterable[bytes | str])[source]

WALLET record

strings

A tuple of bytes, the list of strings.

class dns.rdtypes.ANY.X25.X25(rdclass, rdtype, address)[source]

X25 record

address

A bytes, the PSDN address.

to_text(origin=None, relativize=True, **kw)[source]

Convert an rdata to text format.

Returns a str.

Types specific to class IN

class dns.rdtypes.IN.A.A(rdclass, rdtype, address)[source]

A record.

address

A str, an IPv4 address in the standard “dotted quad” text format.

to_text(origin=None, relativize=True, **kw)[source]

Convert an rdata to text format.

Returns a str.

class dns.rdtypes.IN.AAAA.AAAA(rdclass, rdtype, address)[source]

AAAA record.

address

A str, an IPv6 address in the standard text format.

to_text(origin=None, relativize=True, **kw)[source]

Convert an rdata to text format.

Returns a str.

class dns.rdtypes.IN.APL.APLItem(*args, **kwargs)[source]
family

An int, the address family (in the IANA address family registry).

negation

A bool, is this item negated?

address

A str, the address.

prefix

An int, the prefix length.

class dns.rdtypes.IN.APL.APL(rdclass, rdtype, items)[source]

APL record.

items

A tuple of dns.rdtypes.IN.APL.APLItem.

to_text(origin=None, relativize=True, **kw)[source]

Convert an rdata to text format.

Returns a str.

class dns.rdtypes.IN.DHCID.DHCID(rdclass, rdtype, data)[source]

DHCID record

data

A bytes, the data (the content of the RR is opaque as far as the DNS is concerned).

to_text(origin=None, relativize=True, **kw)[source]

Convert an rdata to text format.

Returns a str.

class dns.rdtypes.IN.HTTPS.HTTPS(rdclass, rdtype, priority, target, params)[source]

HTTPS record

priority

An int, the unsigned 16-bit integer priority.

target

A dns.name.Name, the target name.

params

A dict[dns.rdtypes.svcbbase.ParamKey, dns.rdtypes.svcbbase.Param], the parameters. See the dedicated section SVCB and HTTPS Parameter Classes below for more information on the parameter types.

class dns.rdtypes.IN.IPSECKEY.IPSECKEY(rdclass, rdtype, precedence, gateway_type, algorithm, gateway, key)[source]

IPSECKEY record

precedence

An int, the precedence for the key data.

prefix

An int, the prefix length.

gateway_type

An int, the gateway type.

algorithm

An int, the algorithm to use.

gateway

The gateway. This value may be None, a str` with an IPv4 or IPV6 address, or a ``dns.name.Name.

key

A bytes, the public key.

to_text(origin=None, relativize=True, **kw)[source]

Convert an rdata to text format.

Returns a str.

class dns.rdtypes.IN.KX.KX(rdclass, rdtype, preference, exchange)[source]

KX record

preference

An int, the preference value.

exchange

A dns.name.Name, the exchange name.

class dns.rdtypes.IN.NAPTR.NAPTR(rdclass, rdtype, order, preference, flags, service, regexp, replacement)[source]

NAPTR record

order

An int, the order.

preference

An int, the preference.

flags

A bytes, the flags.

service

A bytes, the service.

regexp

A bytes, the regular expression.

replacement

A dns.name.Name, the replacement name.

to_text(origin=None, relativize=True, **kw)[source]

Convert an rdata to text format.

Returns a str.

class dns.rdtypes.IN.NSAP.NSAP(rdclass, rdtype, address)[source]

NSAP record.

address

A bytes, a NSAP address.

to_text(origin=None, relativize=True, **kw)[source]

Convert an rdata to text format.

Returns a str.

class dns.rdtypes.IN.NSAP_PTR.NSAP_PTR(rdclass, rdtype, target)[source]

NSAP-PTR record

target

A dns.name.Name, the target name.

class dns.rdtypes.IN.PX.PX(rdclass, rdtype, preference, map822, mapx400)[source]

PX record.

preference

An int, the preference value.

map822

A dns.name.Name, the map822 name.

mapx400

A dns.name.Name, the mapx400 name.

to_text(origin=None, relativize=True, **kw)[source]

Convert an rdata to text format.

Returns a str.

class dns.rdtypes.IN.SRV.SRV(rdclass, rdtype, priority, weight, port, target)[source]

SRV record

priority

An int, the priority.

weight

An int, the weight.

port

An int, the port.

target

A dns.name.Name, the target host.

to_text(origin=None, relativize=True, **kw)[source]

Convert an rdata to text format.

Returns a str.

class dns.rdtypes.IN.SVCB.SVCB(rdclass, rdtype, priority, target, params)[source]

SVCB record

priority

An int, the unsigned 16-bit integer priority.

target

A dns.name.Name, the target name.

params

A dict[dns.rdtypes.svcbbase.ParamKey, dns.rdtypes.svcbbase.Param], the parameters. See the dedicated section SVCB and HTTPS Parameter Classes below for more information on the parameter types.

class dns.rdtypes.IN.WKS.WKS(rdclass, rdtype, address, protocol, bitmap)[source]

WKS record

address

A str, the address.

protocol

An int, the protocol.

bitmap

A bytes, the bitmap.

to_text(origin=None, relativize=True, **kw)[source]

Convert an rdata to text format.

Returns a str.

SVCB and HTTPS Parameter Classes

class dns.rdtypes.svcbbase.ParamKey(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

SVCB ParamKey

ALPN
ECH
IPV4HINT
IPV6HINT
MANDATORY
NO_DEFAULT_ALPN
PORT
class dns.rdtypes.svcbbase.Param(*args, **kwargs)[source]
class dns.rdtypes.svcbbase.GenericParam(value)[source]

Generic SVCB parameter

value

A bytes, the value of the parameter.

class dns.rdtypes.svcbbase.MandatoryParam(keys)[source]
keys

A tuple of ParamKey, the keys which are mandatory.

class dns.rdtypes.svcbbase.ALPNParam(ids)[source]
ids

A tuple of bytes values, the APLN ids.

class dns.rdtypes.svcbbase.PortParam(port)[source]
port

An int, the unsigned 16-bit integer port.

class dns.rdtypes.svcbbase.IPv4HintParam(addresses)[source]
addresses

A tuple of string, which each string is an IPv4 address.

class dns.rdtypes.svcbbase.IPv6HintParam(addresses)[source]
addresses

A tuple of string, which each string is an IPv6 address.

class dns.rdtypes.svcbbase.ECHParam(ech)[source]
ech

A bytes.