File: __init__.py

package info (click to toggle)
python-localzone 0.9.8-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 228 kB
  • sloc: python: 521; makefile: 11
file content (48 lines) | stat: -rw-r--r-- 1,203 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#
# You have entered the localzone.
#

"""
The `localzone` DNS Library
~~~~~~~~~~~~~~~~~~~~~~~~~~~

A simple DNS library, written in Python, for managing zone files.

Basic usage:

   >>> import localzone
   >>> with localzone.manage("db.example.com") as z:
   ...     r = z.add_record("greeting", "TXT", "hello, world!")
   ...     r.name    # the record name, i.e. 'greeting'
   ...     r.rdtype  # the record type, i.e. 'TXT'
   ...     r.content # the record content, i.e. '"hello," "world!"'
   ...

Print the zone's resource records:

   >>> import localzone
   >>> with localzone.manage("db.example.com") as z:
   ...     print(*z.records, sep="\\n")
   ...
   @ 3600 IN SOA ns username 2007120710 86400 7200 2419200 3600
   @ 3600 IN NS ns
   @ 3600 IN NS ns.somewhere.example.
   @ 3600 IN MX 10 mail
   @ ...

or:

   >>> import localzone
   >>> with localzone.manage("db.example.com") as z:
   >>>     for r in z.records:
   >>>         print(r)
   ...

The full documentation is available at <https://localzone.iomaestro.com>.

:copyright: (c) 2018 by Andrew Grant Spencer.
:license: BSD, see LICENSE for more details.
"""

from .context import manage, load
from .models import Zone, Record