Skip to main content

Python client for ISC BIND's RNDC

Project description

rndc-python

Python client library for talking to ISC BIND's RNDC service.

Requirements

  • Python 3.10+

Installation

pip install rndc-python

Or using uv:

uv add rndc-python

Command-line Interface

The package includes a CLI tool rndc-python-cli:

# Using CLI options
rndc-python-cli -s 127.0.0.1 -p 953 -a sha256 -k <base64-secret> status

# Using environment variables
export ZPAPI_RNDC_HOST=127.0.0.1
export ZPAPI_RNDC_PORT=953
export ZPAPI_RNDC_ALGORITHM=sha256
export ZPAPI_RNDC_SECRET=<base64-secret>
rndc-python-cli status

# Mix of both (CLI options override env vars)
rndc-python-cli --port 954 reload

Configuration

The client can read its settings from environment variables (or a .env file):

  • ZPAPI_RNDC_HOST
  • ZPAPI_RNDC_PORT
  • ZPAPI_RNDC_ALGORITHM (e.g. hmac-sha256)
  • ZPAPI_RNDC_SECRET
  • ZPAPI_RNDC_TIMEOUT
  • ZPAPI_RNDC_MAX_RETRIES
  • ZPAPI_RNDC_RETRY_DELAY

You can also configure the client directly in Python:

from rndc_python import RNDCClient, TSIGAlgorithm

client = RNDCClient(
    host="127.0.0.1",
    port=953,
    algorithm=TSIGAlgorithm.SHA256,
    secret="your-base64-secret-here",
    timeout=10,
    max_retries=3,
    retry_delay=2,
)

All parameters are optional if you have configured environment variables or a .env file.

Usage

Python API

from rndc_python import RNDCClient

with RNDCClient() as rndc_client:
    print(rndc_client.call("status"))

Development

See DEVELOPMENT.md for development setup, building, and testing instructions.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rndc_python-0.1.1.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rndc_python-0.1.1-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file rndc_python-0.1.1.tar.gz.

File metadata

  • Download URL: rndc_python-0.1.1.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.5

File hashes

Hashes for rndc_python-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6d5f04f3f49334983bba4153add08cec0f444c2bdd380208452d89eb59e4c3aa
MD5 6e4bfebcfa535c322155695bad532d00
BLAKE2b-256 bb2247811147b15ad4b123f654d5fd896f85bb5347a296250e84f69e68110014

See more details on using hashes here.

File details

Details for the file rndc_python-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for rndc_python-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 458906a09116b4af7c058592e9adacc97f430b795dd6c9d9ae429fc3f85a8073
MD5 f2fc70ee24c5d12c1eb8127e135ea8ef
BLAKE2b-256 45eff7466984d03c56eac0798da6084a9f87765518ea172b7fee7468de654569

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page