AIO Netbox
Project description
AIONetbox
An async web client for Netbox
Note
This library currently only supports read operations. PUT/POST support will be coming in a future release of the library.
Installation
AIONetbox is distributed as a library intended to be included in other async python projects. It has been developed on python 3.6+. aionetbox is published on the cheese shop for ease of use.
installation can be as easy as:
pip install aionetbox
or use your virtualenv/tox tooling to guide you.
Example Usage
The idea behind AIONetbox is not to abstract the netbox classes with assumptions but instead offer a non-blocking client for async frameworks. its expected that the developer consuming AIONetbox will be at least a little familiar with the API structure of netbox. If not, the following is a good resource to use when calculating your API routes to query:
Code Sample for a READ device scan:
import asyncio
import json
from aionetbox include AIONetbox
async def run(token):
# Initialize with the host, and your authentication token
nbox = AIONetbox(host='https://netbox.example.com', auth_token=token)
# Provide the api-route you wish to poll, and any key/value args
devices = await nbox.get('/dcim/devices', role='some-role')
# be tidy and close your connection when complete
await nbox.close()
print(json.dumps(devices, indent=2))
# this is setup so we have an event loop and can leverage asyncio
if __name__ == '__main__':
LOOP = asyncio.get_event_loop()
LOOP.run_until_complete(run('my-netbox-token'))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file aionetbox-0.1.0.tar.gz
.
File metadata
- Download URL: aionetbox-0.1.0.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bdfa33f534112ffe42723715cd95f94b2d546ab2fca8fb4856f930b7678b420f |
|
MD5 | b02f1f97c843b57de667242e974237d5 |
|
BLAKE2b-256 | 75c41cb4913b83b8b8c8978a4ad30bc61f18a83f7dd15de6cb50e4e749b7f995 |
File details
Details for the file aionetbox-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: aionetbox-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3388c875fe50b058c7116700e31fd71f23d99258ef997f66ca549b4d3cdcabe2 |
|
MD5 | af1ef1f6c5d0c1b0687d3583f14bf451 |
|
BLAKE2b-256 | 0747f68cdf5861830b83b8e355a0ad42dee17e2d760122f0ef45a7503c234f6e |