Metadata-Version: 2.4
Name: rndc-python
Version: 0.1.0
Summary: Python client for ISC BIND's RNDC
Project-URL: Homepage, https://github.com/davidgroves/rndc-python
Project-URL: Repository, https://github.com/davidgroves/rndc-python
Project-URL: Issues, https://github.com/davidgroves/rndc-python/issues
Author-email: David Groves <dave@fibrecat.org>
License-Expression: MIT
License-File: LICENSE
Keywords: bind,dns,named,rndc,tsig
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Internet :: Name Service (DNS)
Classifier: Topic :: System :: Systems Administration
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: click>=8.1.0
Requires-Dist: dnspython>=2.6.1
Requires-Dist: python-dotenv>=1.0.1
Provides-Extra: dev
Requires-Dist: pre-commit>=4.0.0; extra == 'dev'
Requires-Dist: ruff>=0.8.0; extra == 'dev'
Requires-Dist: ty>=0.0.3; extra == 'dev'
Provides-Extra: test
Requires-Dist: pytest-cov>=6.0.0; extra == 'test'
Requires-Dist: pytest-mock>=3.14.0; extra == 'test'
Requires-Dist: pytest>=8.3.0; extra == 'test'
Requires-Dist: testcontainers>=4.9.0; extra == 'test'
Description-Content-Type: text/markdown

# rndc-python

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

## Requirements

- Python 3.10+

## Installation

```bash
pip install rndc-python
```

Or using uv:

```bash
uv add rndc-python
```

### Command-line Interface

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

```bash
# 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:

```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

```python
from rndc_python import RNDCClient

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

## Development

See [DEVELOPMENT.md](DEVELOPMENT.md) for development setup, building, and testing instructions.
