Metadata-Version: 2.3
Name: librenmsapi
Version: 0.0.3
Summary: Python client for the LibreNMS API
Author: Markus Juenemann
Author-email: Markus Juenemann <markus@juenemann.net>
License: BSD 2-Clause License
         
         Copyright (c) 2023, Markus Juenemann
         
         Redistribution and use in source and binary forms, with or without
         modification, are permitted provided that the following conditions are met:
         
         1. Redistributions of source code must retain the above copyright notice, this
            list of conditions and the following disclaimer.
         
         2. Redistributions in binary form must reproduce the above copyright notice,
            this list of conditions and the following disclaimer in the documentation
            and/or other materials provided with the distribution.
         
         THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
         AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
         IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
         DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
         FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
         DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
         SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
         CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
         OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
         OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Requires-Dist: requests>=2.32.4
Requires-Python: >=3.8
Project-URL: Home, https://github.com/mjuenema/python-librenmsapi
Description-Content-Type: text/markdown

# librenmsapi

**librenmsapi** is Python client library for the [LibreNMS API](https://docs.librenms.org/API/). 

WARNING: This project is in its very early stages and lots of things may change!

The Python code (``librenmsapi.py``) is auto-generated from the Markdown files for the LibreNMS API documentation. 
It should therefore be complete, assuming that the LibreNMS API documentation is complete. 

```python
import librenmsapi

URL = 'http://192.168.1.1'
TOKEN = '3231554f57c1d0d05c5c3c0a2da3ba8f6a1b67f2'

client = librenmsapi.LibreNMS(URL, TOKEN):
```

The endpoint categories (Devices, Inventory, Locations, etc.) are available as attributes of the ``LibreNMS`` class
(in lower-case) and the actual endpoints as their methods.

Required inputs must be provided as arguments, optional inputs can be supplied as keyword arguments.

Any API calls that result in an error will raise ``librenmsapi.ApiException``.

```python

result = client.devices.add_device(hostname='localhost', community='public')
print(result)
# [
#    {
#        'agent_uptime': 0,
#        'authalgo': None,
#        'authlevel': None,
#        'authname': None,
#        'authpass': None,
#        ...
#        'transport': 'udp',
#        'type': '',
#        'uptime': None,
#        'version': None}
# ],


result = client.devices.get_device('localhost')
print(result)
# [
#        {
#            "device_id": "1",
#            "hostname": "localhost",
#            ...
#            "serial": null,
#            "icon": null
#        }
# ]
```

There are other Python libraries you may want to check out.

* [librenms-handler](https://pypi.org/project/librenms-handler/)
* [PyLibreNMS](https://pypi.org/project/PyLibreNMS/)
* [LibreNMSAPIClient](https://github.com/electrocret/LibreNMSAPIClient)
