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
python transform_to_sync.py src/annetbox/v41/client_async.py > src/annetbox/v41/client_sync.py
python transform_to_sync.py src/annetbox/v42/client_async.py > src/annetbox/v42/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.6.0.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

annetbox-0.6.0-py3-none-any.whl (24.3 kB view details)

Uploaded Python 3

File details

Details for the file annetbox-0.6.0.tar.gz.

File metadata

  • Download URL: annetbox-0.6.0.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for annetbox-0.6.0.tar.gz
Algorithm Hash digest
SHA256 cf701909dee4c919e1a64cdd5fc8079f52f006c5e6f3609e78dc9f603e855a00
MD5 6b4539c9a1804e6637df7dfe3a4cf8fd
BLAKE2b-256 c1c14dd4846e5462e0845399f229df1213bc8feb554ceb88b8d4e8f96620ca9b

See more details on using hashes here.

Provenance

The following attestation bundles were made for annetbox-0.6.0.tar.gz:

Publisher: publish-to-pypi.yml on annetutil/annetbox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file annetbox-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: annetbox-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 24.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for annetbox-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7ca6b83045343a063304556aa27f9580dc3ddb7776c10cd001c8b78c5524b3b3
MD5 858f6f0b42624bc25145e1eba86dc789
BLAKE2b-256 7c851a753680d3bc517f02fb57f1acbecd02c7873047192d41275512b19b2e72

See more details on using hashes here.

Provenance

The following attestation bundles were made for annetbox-0.6.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on annetutil/annetbox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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