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.3.tar.gz (14.5 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.3-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: opynsense-0.1.3.tar.gz
  • Upload date:
  • Size: 14.5 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.3.tar.gz
Algorithm Hash digest
SHA256 7dd6e25d5ac26484aecbdb70c70c15a2416227bdc277c34c7e6287060eaf3a5a
MD5 9a4680fb2e718078d900947956e7b8e1
BLAKE2b-256 908357dc378c94cb09df6a18032df0e07d52f434f9c28a744f2abdfb304e2362

See more details on using hashes here.

File details

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

File metadata

  • Download URL: opynsense-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 15.8 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 58bf467b937903fcef008cdb7711f8145566624a9d76b721e4271bc066d1ee41
MD5 7e9fb7a5f2b0f39179bdde85e4c08bc3
BLAKE2b-256 fc01e14ea61b95f73ac0ab00a6b665bc19f0c0d1c0e02b74833102e0e794fde4

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