Package dns :: Module zone
[hide private]
[frames] | no frames]

Module zone

source code

DNS Zones.

Classes [hide private]
  BadZone
The zone is malformed.
  NoSOA
The zone has no SOA RR at its origin.
  NoNS
The zone has no NS RRset at its origin.
  UnknownOrigin
The zone's origin is unknown.
  Zone
A DNS zone.
  _MasterReader
Read a DNS master file
Functions [hide private]
dns.zone.Zone object
from_text(text, origin=None, rdclass=1, relativize=True, zone_factory=<class 'dns.zone.Zone'>, filename=None, allow_include=False, check_origin=True)
Build a zone object from a master file format string.
source code
dns.zone.Zone object
from_file(f, origin=None, rdclass=1, relativize=True, zone_factory=<class 'dns.zone.Zone'>, filename=None, allow_include=True, check_origin=True)
Read a master file and build a zone object.
source code
dns.zone.Zone object
from_xfr(xfr, zone_factory=<class 'dns.zone.Zone'>, relativize=True, check_origin=True)
Convert the output of a zone transfer generator into a zone object.
source code
Variables [hide private]
  __package__ = 'dns'
Function Details [hide private]

from_text(text, origin=None, rdclass=1, relativize=True, zone_factory=<class 'dns.zone.Zone'>, filename=None, allow_include=False, check_origin=True)

source code 

Build a zone object from a master file format string.

Parameters:
  • text (string.) - the master file format input
  • origin (dns.name.Name object or string) - The origin of the zone; if not specified, the first $ORIGIN statement in the master file will determine the origin of the zone.
  • rdclass (int) - The zone's rdata class; the default is class IN.
  • relativize (bool) - should names be relativized? The default is True
  • zone_factory (function returning a Zone) - The zone factory to use
  • filename (string) - The filename to emit when describing where an error occurred; the default is '<string>'.
  • allow_include (bool) - is $INCLUDE allowed?
  • check_origin (bool) - should sanity checks of the origin node be done? The default is True.
Returns: dns.zone.Zone object
Raises:

from_file(f, origin=None, rdclass=1, relativize=True, zone_factory=<class 'dns.zone.Zone'>, filename=None, allow_include=True, check_origin=True)

source code 

Read a master file and build a zone object.

Parameters:
  • f - file or string. If f is a string, it is treated as the name of a file to open.
  • origin (dns.name.Name object or string) - The origin of the zone; if not specified, the first $ORIGIN statement in the master file will determine the origin of the zone.
  • rdclass (int) - The zone's rdata class; the default is class IN.
  • relativize (bool) - should names be relativized? The default is True
  • zone_factory (function returning a Zone) - The zone factory to use
  • filename (string) - The filename to emit when describing where an error occurred; the default is '<file>', or the value of f if f is a string.
  • allow_include (bool) - is $INCLUDE allowed?
  • check_origin (bool) - should sanity checks of the origin node be done? The default is True.
Returns: dns.zone.Zone object
Raises:

from_xfr(xfr, zone_factory=<class 'dns.zone.Zone'>, relativize=True, check_origin=True)

source code 

Convert the output of a zone transfer generator into a zone object.

Parameters:
  • xfr (generator of dns.message.Message objects) - The xfr generator
  • relativize (bool) - should names be relativized? The default is True. It is essential that the relativize setting matches the one specified to dns.query.xfr().
  • check_origin (bool) - should sanity checks of the origin node be done? The default is True.
Returns: dns.zone.Zone object
Raises: