Skip to main content

A Python library for interacting with OpnSense router OS through the REST API

Project description

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.

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

opynsense-0.1.2.tar.gz (14.1 kB view details)

Uploaded Source

Built Distribution

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

opynsense-0.1.2-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file opynsense-0.1.2.tar.gz.

File metadata

  • Download URL: opynsense-0.1.2.tar.gz
  • Upload date:
  • Size: 14.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.11.13 Linux/6.11.0-1018-azure

File hashes

Hashes for opynsense-0.1.2.tar.gz
Algorithm Hash digest
SHA256 8a4f1390f4cf4c3538726091e97134d8c6c8fa8b4c20efed91f2c4882fade812
MD5 52d62f9436f94b3f71799b7f1788c099
BLAKE2b-256 7693e4b076d1eb6e86b9a070426306ad7a18991e54560d66e60405c942418c4a

See more details on using hashes here.

File details

Details for the file opynsense-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: opynsense-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.11.13 Linux/6.11.0-1018-azure

File hashes

Hashes for opynsense-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 981266c9b3ccf241da6c12d7a402abb878560d79c92ec69a815d761f4ce4d367
MD5 7d66d94b4b4db50d266803b10f7ed78a
BLAKE2b-256 549af19b0717de6675172ef35d5a79df020b81a470965a21c00b36011b17de1a

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