Skip to main content

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 class
  • src/opynsense/classes/kea.py: Kea DHCP and lease management classes
  • tests/: 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)

Source distribution for opynsense 0.1.4
File Size Uploaded
opynsense-0.1.4.tar.gz 14.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for opynsense 0.1.4
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

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