Skip to main content

DNScode

Simplifying DNS Zone management


About

DNScode is a project to help simplify DNS zone management, when using plain text files with servers like BIND and NSD. It provides a framework for programmatically generating zone files with Python, allowing for more flexability, compared to other DNS as code solutions.

Installation

# Create working directory
mkdir dnsproject
cd dnsproject

# Create virtual envrionment (optional, but highly recomended)
python3 -m venv .venv
source .venv/bin/activate

# Install the dnscode package
pip install dnscode

Usage

Import the dnscode package into a python script, create a zone object, then add records into the zone. Records can be added either via helper functions in the dnscode.Zone class, or by manually creating record objects and adding them through dnscode.Zone.add(). Both methods are shown in the example below.

Once the zone is setup, you can save it as a text file using dnscode.Zone.save_file(). Currently, it also outputs to to STDOUT. See https://code.minecraftchest1.us/minecraftchest1/dnscode/issues/5 for details.

API docs at https://dnscode.minecraftchest1.us/classdnscode_1_1dnscode_1_1Zone

import dnscode

zone = dnscode.Zone(origin='example.com')				# Create zone object
zone.new_SOA(mname='ns1.minecraftchest1.us.',			# Create SOA
	rname='admin.minecraftchest1.us.',
	refresh=onemonth, retry=oneday, ttl=oneday)
zone.new_A(name='myhost', ttl=3600, host='0.0.0.0')		#New A record
zone.new_AAAA(name='myhost', ttl-3600, hosts='::1')
# More helper functions in the docs

cname = dnscode.CNAME(name='mycname', ttl=60, host='example.com')
# More record objects in the docs.
zone.add(cname)

zone.save_file('example.zone')

Metadata

Release files for dnscode 1.6.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dnscode 1.6.4
File Size Uploaded Provenance Actions
dnscode-1.6.4.tar.gz 6.2 MB Without provenance Details for dnscode-1.6.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dnscode 1.6.4
File Interpreter ABI Platform Actions
dnscode-1.6.4-py3-none-any.whl Python 3 none any Details for dnscode-1.6.4-py3-none-any.whl

Total release size: 6.2 MB

Release files / dnscode-1.6.4.tar.gz

Download URL dnscode-1.6.4.tar.gz
Size 6.2 MB
Tags Source
SHA-256 checksum
How to use checksums
2381c216d7e6a400e3561aa5ac77c44a7b2092665ade4b51408cf737b1b9cde3
BLAKE2b-256 checksum
How to use checksums
421b80fd2585aaa5bf8727b10c94232fb90de7bb73b6d2b381aedffc0c2803de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release files / dnscode-1.6.4-py3-none-any.whl

Download URL dnscode-1.6.4-py3-none-any.whl
Size 16.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c718ff8cb89bc470f21d6120f43f3aba4c5012bb82bdb36d5270dff0c8bd6fcc
BLAKE2b-256 checksum
How to use checksums
8c9b72e8ac97f3ddc98a8901b40452a466c25dcb12d907917aa3c3ea4410a1bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Security for dnscode 1.6.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page