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
Hashes for aionetbox-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3388c875fe50b058c7116700e31fd71f23d99258ef997f66ca549b4d3cdcabe2 |
|
MD5 | af1ef1f6c5d0c1b0687d3583f14bf451 |
|
BLAKE2b-256 | 0747f68cdf5861830b83b8e355a0ad42dee17e2d760122f0ef45a7503c234f6e |