dnspython  1.16.0
About: dnspython is a DNS toolkit (for Python 2.x) that supports almost all record types.
  Fossies Dox: dnspython-1.16.0.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

dns.zone Namespace Reference

Classes

class  _MasterReader
 
class  BadZone
 
class  NoNS
 
class  NoSOA
 
class  UnknownOrigin
 
class  Zone
 

Functions

def from_text (text, origin=None, rdclass=dns.rdataclass.IN, relativize=True, zone_factory=Zone, filename=None, allow_include=False, check_origin=True)
 
def from_file (f, origin=None, rdclass=dns.rdataclass.IN, relativize=True, zone_factory=Zone, filename=None, allow_include=True, check_origin=True)
 
def from_xfr (xfr, zone_factory=Zone, relativize=True, check_origin=True)
 

Function Documentation

◆ from_file()

def dns.zone.from_file (   f,
  origin = None,
  rdclass = dns.rdataclass.IN,
  relativize = True,
  zone_factory = Zone,
  filename = None,
  allow_include = True,
  check_origin = True 
)
Read a master file and build a zone object.

@param f: file or string.  If I{f} is a string, it is treated
as the name of a file to open.
@param origin: The origin of the zone; if not specified, the first
$ORIGIN statement in the master file will determine the origin of the
zone.
@type origin: dns.name.Name object or string
@param rdclass: The zone's rdata class; the default is class IN.
@type rdclass: int
@param relativize: should names be relativized?  The default is True
@type relativize: bool
@param zone_factory: The zone factory to use
@type zone_factory: function returning a Zone
@param filename: The filename to emit when describing where an error
occurred; the default is '<file>', or the value of I{f} if I{f} is a
string.
@type filename: string
@param allow_include: is $INCLUDE allowed?
@type allow_include: bool
@param check_origin: should sanity checks of the origin node be done?
The default is True.
@type check_origin: bool
@raises dns.zone.NoSOA: No SOA RR was found at the zone origin
@raises dns.zone.NoNS: No NS RRset was found at the zone origin
@rtype: dns.zone.Zone object

Definition at line 1032 of file zone.py.

References dns.zone.from_text().

◆ from_text()

def dns.zone.from_text (   text,
  origin = None,
  rdclass = dns.rdataclass.IN,
  relativize = True,
  zone_factory = Zone,
  filename = None,
  allow_include = False,
  check_origin = True 
)
Build a zone object from a master file format string.

@param text: the master file format input
@type text: string.
@param origin: The origin of the zone; if not specified, the first
$ORIGIN statement in the master file will determine the origin of the
zone.
@type origin: dns.name.Name object or string
@param rdclass: The zone's rdata class; the default is class IN.
@type rdclass: int
@param relativize: should names be relativized?  The default is True
@type relativize: bool
@param zone_factory: The zone factory to use
@type zone_factory: function returning a Zone
@param filename: The filename to emit when describing where an error
occurred; the default is '<string>'.
@type filename: string
@param allow_include: is $INCLUDE allowed?
@type allow_include: bool
@param check_origin: should sanity checks of the origin node be done?
The default is True.
@type check_origin: bool
@raises dns.zone.NoSOA: No SOA RR was found at the zone origin
@raises dns.zone.NoNS: No NS RRset was found at the zone origin
@rtype: dns.zone.Zone object

Definition at line 988 of file zone.py.

Referenced by dns.zone.from_file().

◆ from_xfr()

def dns.zone.from_xfr (   xfr,
  zone_factory = Zone,
  relativize = True,
  check_origin = True 
)
Convert the output of a zone transfer generator into a zone object.

@param xfr: The xfr generator
@type xfr: generator of dns.message.Message objects
@param relativize: should names be relativized?  The default is True.
It is essential that the relativize setting matches the one specified
to dns.query.xfr().
@type relativize: bool
@param check_origin: should sanity checks of the origin node be done?
The default is True.
@type check_origin: bool
@raises dns.zone.NoSOA: No SOA RR was found at the zone origin
@raises dns.zone.NoNS: No NS RRset was found at the zone origin
@rtype: dns.zone.Zone object

Definition at line 1088 of file zone.py.