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.8.tar.gz
(8.6 kB
view details)
Built Distribution
annetbox-0.1.8-py3-none-any.whl
(12.7 kB
view details)
File details
Details for the file annetbox-0.1.8.tar.gz
.
File metadata
- Download URL: annetbox-0.1.8.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37f203f59370bafb8e07038fc4a96426fa415f1f3387f40a05d052d6acf7c769 |
|
MD5 | b033e6e7d52a1cdf119b62a0a82c2c99 |
|
BLAKE2b-256 | db52ddab6fa0ae1d57bbcdc9ac5d0ae19c4aa5fd4318d5b58ae78e088f46e279 |
File details
Details for the file annetbox-0.1.8-py3-none-any.whl
.
File metadata
- Download URL: annetbox-0.1.8-py3-none-any.whl
- Upload date:
- Size: 12.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3aebfc90ad6a70381f7caacd288fc8df6ea00c49763def8d78337c99ac86a60c |
|
MD5 | 06abe29883b775a6ff54f9f147e099bb |
|
BLAKE2b-256 | c8fcc5fd67a9623f011aede48a40a1536c04fc248013d5a732994a7dc8e1ba6e |