Skip to content

nserver.records 🔗

A 🔗

A(
    resource_name: str,
    ip: Union[str, IPv4Address],
    ttl: int = 300,
)

Bases: RecordBase

Ipv4 Address (A) Record.

Parameters:

Name Type Description Default
resource_name str

DNS resource name

required
ip Union[str, IPv4Address]

IPv4 address of the resource

required
ttl int

record time-to-live in seconds

300

to_resource_record 🔗

to_resource_record() -> dnslib.RR

Convert Record to a dnslib Resource Record

AAAA 🔗

AAAA(
    resource_name: str,
    ip: Union[str, IPv6Address],
    ttl: int = 300,
)

Bases: RecordBase

Ipv6 Address (AAAA) Record.

Parameters:

Name Type Description Default
resource_name str

DNS resource name

required
ip Union[str, IPv6Address]

IPv6 address of the resource

required
ttl int

record time-to-live in seconds

300

to_resource_record 🔗

to_resource_record() -> dnslib.RR

Convert Record to a dnslib Resource Record

CAA 🔗

CAA(
    resource_name: str,
    flags: int,
    tag: str,
    value: str,
    ttl: int = 3600,
)

Bases: RecordBase

Certificate Authority Authorisation (CAA) Record

See also
  • https://datatracker.ietf.org/doc/html/rfc6844
  • https://support.dnsimple.com/articles/caa-record/

Parameters:

Name Type Description Default
resource_name str

domain name this record applies to

required
flags int

8bit numbers for flags

required
tag str

type of CAA record

required
value str

value for given tag (see RFC for more info)

required
ttl int

record time-to-live in seconds

3600

to_resource_record 🔗

to_resource_record() -> dnslib.RR

Convert Record to a dnslib Resource Record

CNAME 🔗

CNAME(resource_name: str, domain: str, ttl: int = 300)

Bases: RecordBase

Canonical Name (CNAME) Record.

Parameters:

Name Type Description Default
resource_name str

DNS resource name

required
domain str

canonical domain for this name

required
ttl int

record time-to-live in seconds

300

to_resource_record 🔗

to_resource_record() -> dnslib.RR

Convert Record to a dnslib Resource Record

MX 🔗

MX(
    resource_name: str,
    domain: str,
    priority: int = 10,
    ttl: int = 300,
)

Bases: RecordBase

Mail Exchange (MX) Record

See also
  • https://datatracker.ietf.org/doc/html/rfc1035#section-3.3.9
  • https://en.wikipedia.org/wiki/MX_record

Parameters:

Name Type Description Default
resource_name str

DNS resource name

required
domain str

DNS name of mail exchange. Note: domain must not point to a CNAME record.

required
priority int

mail exchange priority (0 is highest priority)

10
ttl int

record time-to-live in seconds

300

to_resource_record 🔗

to_resource_record() -> dnslib.RR

Convert Record to a dnslib Resource Record

NS 🔗

NS(resource_name: str, domain: str, ttl: int = 3600)

Bases: CNAME

Name Server (NS) Record.

See also
  • https://datatracker.ietf.org/doc/html/rfc1035#section-3.3.11

Parameters:

Name Type Description Default
resource_name str

DNS resource name

required
domain str

domain name of the Name Server

required
ttl int

record time-to-live in seconds

3600

to_resource_record 🔗

to_resource_record() -> dnslib.RR

Convert Record to a dnslib Resource Record

PTR 🔗

PTR(resource_name: str, domain: str, ttl: int = 300)

Bases: CNAME

Pointer (PTR) Record.

See also
  • https://datatracker.ietf.org/doc/html/rfc1035#section-3.3.12

Parameters:

Name Type Description Default
resource_name str

DNS resource name

required
domain str

domain to point to

required
ttl int

record time-to-live in seconds

300

to_resource_record 🔗

to_resource_record() -> dnslib.RR

Convert Record to a dnslib Resource Record

RecordBase 🔗

RecordBase(resource_name: str, ttl: int)

Base class for all DNS records.

Note: MUST NOT be used directly

Subclasses must set _record_kwargs

Parameters:

Name Type Description Default
resource_name str

DNS resource name

required
ttl int

record time-to-live in seconds

required

to_resource_record 🔗

to_resource_record() -> dnslib.RR

Convert Record to a dnslib Resource Record

SOA 🔗

SOA(
    zone_name: str,
    primary_name_server: str,
    admin_email: str,
    zone_serial: int,
    refresh_period: int = 86400,
    retry_period: int = 7200,
    expires: int = 3600000,
    minimum_ttl: int = 172800,
    ttl: int = 3600,
)

Bases: RecordBase

Start of Authority (`SOA``) Record

See also
  • https://datatracker.ietf.org/doc/html/rfc1035#section-3.3.13
  • https://en.wikipedia.org/wiki/SOA_record

Parameters:

Name Type Description Default
zone_name str

name of the DNS zone

required
primary_name_server str

domain name of primary name server for this domain

required
admin_email str

Domain encoded email address of the administrator responsible for this zone. The part of the email address before the @ becomes the first label of the name; the domain name after the @ becomes the rest of the name. In zone-file format, dots in labels are escaped with backslashes; thus the email address john.doe@example.com would be represented in a zone file as john.doe.example.com.)

required
zone_serial int

Serial number for this zone. If a secondary name server following this one observes an increase in this number, the follower will assume that the zone has been updated and initiate a zone transfer.

required
refresh_period int

Number of seconds after which secondary name servers should query the master for the SOA record, to detect zone changes. Recommendation for small and stable zones: 86400 seconds (24 hours).

86400
retry_period int

Number of seconds after which secondary name servers should retry to request the serial number from the master if the master does not respond. It must be less than Refresh. Recommendation for small and stable zones: 7200 seconds (2 hours).

7200
expires int

Number of seconds after which secondary name servers should stop answering request for this zone if the master does not respond. This value must be bigger than the sum of Refresh and Retry. Recommendation for small and stable zones: 3600000 seconds (1000 hours).

3600000
minimum_ttl int

Used in calculating the time to live for purposes of negative caching. Authoritative name servers take the smaller of the SOA TTL and the SOA MINIMUM to send as the SOA TTL in negative responses. Resolvers use the resulting SOA TTL to understand for how long they are allowed to cache a negative response. Recommendation for small and stable zones: 172800 seconds (2 days)

172800
ttl int

record time-to-live in seconds

3600

to_resource_record 🔗

to_resource_record() -> dnslib.RR

Convert Record to a dnslib Resource Record

SRV 🔗

SRV(
    resource_name: str,
    target: str,
    port: int,
    priority: int,
    weight: int,
    ttl: int = 300,
)

Bases: RecordBase

Service (SRV) Record

See also
  • https://datatracker.ietf.org/doc/html/rfc2782

Parameters:

Name Type Description Default
resource_name str

Full name of service in _Service._Proto.Name format.

required
target str

domain name of target host

required
port int

port on target host

required
priority int

priority of target host. 0 is highest.

required
weight int

relative weight of this target for targets with same priority. 0 is lowest.

required
ttl int

record time-to-live in seconds

300

to_resource_record 🔗

to_resource_record() -> dnslib.RR

Convert Record to a dnslib Resource Record

TXT 🔗

TXT(resource_name: str, text: str, ttl: int = 300)

Bases: RecordBase

Text (TXT) Record

Parameters:

Name Type Description Default
resource_name str

DNS resource name

required
text str

value of the record

required
ttl int

record time-to-live in seconds

300

to_resource_record 🔗

to_resource_record() -> dnslib.RR

Convert Record to a dnslib Resource Record