Skip to main content

Annet Netbox client

Project description

Annetbox - Netbox client used by annet and related projects

This project implements subset of Netbox API methods

Usage

  1. Install sync or async version
pip install 'annetbox[sync]'
  1. 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")
  1. 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

  1. Create context
import ssl

context = ssl.create_default_context(cafile="path/to/cacert.pem")
  1. Pass it to client
netbox = NetboxV37(url=url, token=token, ssl_context=context)

Development

Adding new methods

  1. Read openapi spec
  2. Edit models.py
  3. Edit client_async.py, do not forget adding limit/offset
  4. Convert async code to sync
python transform_to_sync.py src/annetbox/v37/client_async.py > src/annetbox/v37/client_sync.py

Project details


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)

Uploaded Source

Built Distribution

annetbox-0.1.8-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

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

Hashes for annetbox-0.1.8.tar.gz
Algorithm Hash digest
SHA256 37f203f59370bafb8e07038fc4a96426fa415f1f3387f40a05d052d6acf7c769
MD5 b033e6e7d52a1cdf119b62a0a82c2c99
BLAKE2b-256 db52ddab6fa0ae1d57bbcdc9ac5d0ae19c4aa5fd4318d5b58ae78e088f46e279

See more details on using hashes here.

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

Hashes for annetbox-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 3aebfc90ad6a70381f7caacd288fc8df6ea00c49763def8d78337c99ac86a60c
MD5 06abe29883b775a6ff54f9f147e099bb
BLAKE2b-256 c8fcc5fd67a9623f011aede48a40a1536c04fc248013d5a732994a7dc8e1ba6e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page