Nautobot API client library
Python API client library for Nautobot.
Pynautobot was initially developed as a fork of pynetbox. Pynetbox was originally developed by Zach Moody at DigitalOcean and the NetBox Community.
The complete documentation for pynautobot can be found at Read the Docs.
Questions? Comments? Join us in the #nautobot Slack channel on Network to Code!
$ pip install pynautobot ...
$ git clone https://github.com/nautobot/pynautobot.git ... $ pip install poetry ... $ poetry shell Virtual environment already activated: /home/user/pynautobot/.venv $ poetry install ...
A short introduction is provided here; the full documention for pynautobot is at Read the Docs.
To begin, import pynautobot and instantiate an
Api object, passing the
import pynautobot nautobot = pynautobot.api( url="http://localhost:8000", token="d6f4e314a5b5fefd164995169f28ae32d987704f", )
The Api object provides access to the Apps in Nautobot.
The Apps provide access to the Models and the field data stored in Nautobot.
Pynautobot uses the
Endpoint class to represent Models.
For example, here is how to access Devices stored in Nautobot:
devices = nautobot.dcim.devices devices <pynautobot.core.endpoint.Endpoint object at 0x7fe801e62fa0>
Pynautobot provides several ways to retrieve objects from Nautobot.
get() method is show here.
To continue from the example above, the
Endpoint object returned will be used to
the device named hq-access-01.
switch = devices.get(nam="hq-access-01")
The object returned from the
get() method is an implementation of the
This object provides access to the field data from Nautobot.
switch.id '6929b68d-8f87-4470-8377-e7fdc933a2bb' switch.name 'hq-access-01' switch.site hq
Pynautobot supports multithreaded calls for
.all() queries. It is highly recommended you have
MAX_PAGE_SIZE in your Nautobot install set to anything except
None. The default value of
1000 is usually a good value to use. To enable threading, add
threading=True parameter when instantiating the
nautobot = pynautobot.api( url="http://localhost:8000", token="d6f4e314a5b5fefd164995169f28ae32d987704f", threading=True, )
Used for Nautobot Rest API versioning. Versioning can be controlled globally by setting
api_version on initialization of the
API class and/or for a specific request e.g (
create() etc.) by setting an optional
import pynautobot nautobot = pynautobot.api( url="http://localhost:8000", token="d6f4e314a5b5fefd164995169f28ae32d987704f", api_version="1.3" )
Request specific versioning
import pynautobot nautobot = pynautobot.api( url="http://localhost:8000", token="d6f4e314a5b5fefd164995169f28ae32d987704f", ) tags = nautobot.extras.tags tags.create(name="Tag", slug="tag", api_version="1.2",) tags.list(api_version="1.3",)
Please see our wiki for a list of relevant community projects.
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Hashes for pynautobot-1.1.1-py3-none-any.whl