pyopnsense


Namepyopnsense JSON
Version 0.4.0 PyPI version JSON
download
home_page
SummaryA python API client for OPNsense
upload_time2023-06-18 19:46:13
maintainer
docs_urlNone
authorMatthew Treinish
requires_python>=3.8
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ==========
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


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "pyopnsense",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "",
    "author": "Matthew Treinish",
    "author_email": "mtreinish@kortar.org",
    "download_url": "https://files.pythonhosted.org/packages/d3/08/1dc0e7948764c59635a560dfd14a15266a5efdb4e628ec737bcfb6a1d59e/pyopnsense-0.4.0.tar.gz",
    "platform": null,
    "description": "==========\npyopnsense\n==========\nYou can see the full rendered docs at: http://pyopnsense.readthedocs.io/en/latest/\n\nA python API client for the OPNsense API. This provides a python interface for\ninteracting with the OPNsense API.\n\n\nInstallation\n============\npyopnsense is available via pypi so all you need to do is run::\n\n   pip install -U pyopnsense\n\nto get the latest pyopnsense release on your system. If you need to use a\ndevelopment version of pyopnsense you can clone the repo and install it locally\nwith::\n\n  git clone https://github.com/mtreinish/pyopnsense && pip install -e pyopnsense\n\nwhich will install pyopnsense in your python environment in editable mode for\ndevelopment.\n\n.. _usage:\n\nUsage\n=====\n\nTo use pyopnsense you need a couple pieces of information, the API key and the\nAPI secret. Both can be created/found from the OPNsense web UI by navigating\nto: `System->Access->Users` under `API keys`.\n\nMore information on this can be found in the OPNsense documentation:\nhttps://docs.opnsense.org/development/how-tos/api.html\n\nOnce you have the API key and API secret you can use pyopnsense to interact\nwith your OPNsense installation. You can do this by passing your credentials\nto a client class. For example:\n\n.. code-block:: python\n\n    from pyopnsense import diagnostics\n\n    api_key = 'XXXXXX'\n    api_secret = 'XXXXXXXXXXXXXXX'\n    opnsense_url = 'http://192.168.1.1/api'\n    timeout = 5\n\n    netinsight_client = diagnostics.NetworkInsightClient(\n        api_key, api_secret, opnsense_url, timeout)\n\n    print(netinsight_client.get_interfaces())\n\nwhich will print a dictionary mapping physical devices to their interface label.\n\nThis same formula can be used to access each individual API endpoint you need\nto access. The basic structure of the library is setup to roughly mirror the\nendpoint tree of the OPNsense API. Each client module maps to the base endpoint\nand then there is a client class in those modules for the next level up off\nthat.\n\nYou can find more detail on how to use the clients in the API reference\ndocumentation found here:\n\nhttp://pyopnsense.readthedocs.io/en/latest/api.html\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A python API client for OPNsense",
    "version": "0.4.0",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "822a2d444c937ca5d5e69cf56cbc4577f91f95027d48a5a80892bb1c096e1f49",
                "md5": "3968015b81bfdf67703a8d028931c49a",
                "sha256": "0d5ef9de0383a37f7c17e5b7011e345fccd965d0d4188faa155a884f689b0eb1"
            },
            "downloads": -1,
            "filename": "pyopnsense-0.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3968015b81bfdf67703a8d028931c49a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 23831,
            "upload_time": "2023-06-18T19:46:11",
            "upload_time_iso_8601": "2023-06-18T19:46:11.784385Z",
            "url": "https://files.pythonhosted.org/packages/82/2a/2d444c937ca5d5e69cf56cbc4577f91f95027d48a5a80892bb1c096e1f49/pyopnsense-0.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d3081dc0e7948764c59635a560dfd14a15266a5efdb4e628ec737bcfb6a1d59e",
                "md5": "17a8a7ec8b53006feec45cd8373575d6",
                "sha256": "dc32a556b3ad31ae79813bb9e7ba60a23469760acee69119dcbfbd80aa16f728"
            },
            "downloads": -1,
            "filename": "pyopnsense-0.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "17a8a7ec8b53006feec45cd8373575d6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 22548,
            "upload_time": "2023-06-18T19:46:13",
            "upload_time_iso_8601": "2023-06-18T19:46:13.175180Z",
            "url": "https://files.pythonhosted.org/packages/d3/08/1dc0e7948764c59635a560dfd14a15266a5efdb4e628ec737bcfb6a1d59e/pyopnsense-0.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-18 19:46:13",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "pyopnsense"
}
        
Elapsed time: 0.10052s