Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pyopnsense

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pyopnsense

A python API client for OPNsense

  • 0.4.0
  • PyPI
  • Socket score

Maintainers
1

========== pyopnsense

You can see the full rendered docs at: http://pyopnsense.readthedocs.io/en/latest/

A python API client for the OPNsense API. This provides a python interface for interacting with the OPNsense API.

Installation

pyopnsense is available via pypi so all you need to do is run::

pip install -U pyopnsense

to get the latest pyopnsense release on your system. If you need to use a development version of pyopnsense you can clone the repo and install it locally with::

git clone https://github.com/mtreinish/pyopnsense && pip install -e pyopnsense

which will install pyopnsense in your python environment in editable mode for development.

.. _usage:

Usage

To use pyopnsense you need a couple pieces of information, the API key and the API secret. Both can be created/found from the OPNsense web UI by navigating to: System->Access->Users under API keys.

More information on this can be found in the OPNsense documentation: https://docs.opnsense.org/development/how-tos/api.html

Once you have the API key and API secret you can use pyopnsense to interact with your OPNsense installation. You can do this by passing your credentials to a client class. For example:

.. code-block:: python

from pyopnsense import diagnostics

api_key = 'XXXXXX'
api_secret = 'XXXXXXXXXXXXXXX'
opnsense_url = 'http://192.168.1.1/api'
timeout = 5

netinsight_client = diagnostics.NetworkInsightClient(
    api_key, api_secret, opnsense_url, timeout)

print(netinsight_client.get_interfaces())

which will print a dictionary mapping physical devices to their interface label.

This same formula can be used to access each individual API endpoint you need to access. The basic structure of the library is setup to roughly mirror the endpoint tree of the OPNsense API. Each client module maps to the base endpoint and then there is a client class in those modules for the next level up off that.

You can find more detail on how to use the clients in the API reference documentation found here:

http://pyopnsense.readthedocs.io/en/latest/api.html

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc