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.4.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.4-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: opynsense-0.1.4.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.11.15 Linux/6.17.0-1015-azure

File hashes

Hashes for opynsense-0.1.4.tar.gz
Algorithm Hash digest
SHA256 02f2262765dc0f3d814d412651f806ba48b8ae0a083859d29da69f4e2925718d
MD5 696c1ae67ea83f414d3e4a085e6cebcd
BLAKE2b-256 6b19d1defce0ec19da8b5f849223f70f51128439ee0b457c1a48d698b5965cb2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: opynsense-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 15.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.11.15 Linux/6.17.0-1015-azure

File hashes

Hashes for opynsense-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 967065bee89cef2d147a0a476e17c632e4f87c0ee68f20e76a2e0b272e3fb379
MD5 2296112af9851741b2c1c57ea8e4f522
BLAKE2b-256 e4bddd0170caa360934f31918efde54f0264c0e02db76046bbfbda8f468761a6

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