OpynSense
OpynSense is a Python client library for interacting with the OpnSense router API, providing convenient access to DHCP and lease management via Kea. It is designed for automation and integration with network infrastructure in homelab or enterprise environments.
Features
- Authenticate and manage sessions with OpnSense
- Retrieve DHCPv4 configuration and reservations
- Search and filter DHCP leases by interface description
- Extensible for additional OpnSense API endpoints
Installation
Install via pip (after packaging):
pip install opynsense
Usage
from opynsense.main import OpnSense
# Initialize client
opnsense = OpnSense(auth='your_auth_token', base_url='https://your-opnsense/api')
# Access Kea DHCPv4 configuration
dhcp = opnsense.KeaDHCPv4()
config = dhcp.get()
# Access DHCP reservations
reservations = dhcp.Reservation().get()
# Search DHCP reservations
search_results = dhcp.Reservation().search()
# Access and search DHCP leases
leases = opnsense.KeaLeasev4().search(interface_description='LAN')
Project Structure
src/opynsense/main.py: Main OpnSense client classsrc/opynsense/classes/kea.py: Kea DHCP and lease management classestests/: Unit tests
License
See LICENSE for details.
Metadata
Release files for opynsense 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| opynsense-0.1.4.tar.gz | 14.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| opynsense-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.4 kB
Release files / opynsense-0.1.4.tar.gz
| Download URL | opynsense-0.1.4.tar.gz |
|---|---|
| Size | 14.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
02f2262765dc0f3d814d412651f806ba48b8ae0a083859d29da69f4e2925718d
|
|
BLAKE2b-256 checksum How to use checksums |
6b19d1defce0ec19da8b5f849223f70f51128439ee0b457c1a48d698b5965cb2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.11.15 Linux/6.17.0-1015-azure
|
Release files / opynsense-0.1.4-py3-none-any.whl
| Download URL | opynsense-0.1.4-py3-none-any.whl |
|---|---|
| Size | 15.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
967065bee89cef2d147a0a476e17c632e4f87c0ee68f20e76a2e0b272e3fb379
|
|
BLAKE2b-256 checksum How to use checksums |
e4bddd0170caa360934f31918efde54f0264c0e02db76046bbfbda8f468761a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.11.15 Linux/6.17.0-1015-azure
|