Annet Netbox client
Project description
Annetbox - Netbox client used by annet and related projects
This project implements subset of Netbox API methods
Usage
- Install
sync
orasync
version
pip install 'annetbox[sync]'
- Create client instance according to your netbox version (only some are supported)
from annetbox.v37.client_sync import NetboxV37
netbox = NetboxV37(url="https://demo.netbox.dev", token="YOUR NETBOX TOKEN")
- Call methods
res = netbox.dcim_devices(limit=1)
Configuration
Verbose logging
For sync client
import http.client
import logging
logging.basicConfig()
http.client.HTTPConnection.debuglevel = 1
requests_log = logging.getLogger("requests.packages.urllib3")
requests_log.setLevel(logging.DEBUG)
requests_log.propagate = True
Custom SSL context
- Create context
import ssl
context = ssl.create_default_context(cafile="path/to/cacert.pem")
- Pass it to client
netbox = NetboxV37(url=url, token=token, ssl_context=context)
Development
Adding new methods
- Read openapi spec
- Edit
models.py
- Edit
client_async.py
, do not forget addinglimit
/offset
- Convert async code to sync
python transform_to_sync.py src/annetbox/v37/client_async.py > src/annetbox/v37/client_sync.py
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
annetbox-0.1.1.tar.gz
(8.0 kB
view hashes)
Built Distribution
annetbox-0.1.1-py3-none-any.whl
(11.7 kB
view hashes)