APP Module

class pynautobot.core.app.App(api, name)

Bases: object

Represents apps in Nautobot.

Calls to attributes are returned as Endpoint objects.

Returns:

Endpoint matching requested attribute.

Raises:

RequestError if requested endpoint doesn’t exist.

__init__(api, name)
choices()

Returns _choices response from App

Note

This method is deprecated and only works with Nautobot version 2.7.x or older. The choices() method in Endpoint is compatible with all Nautobot versions.

Returns:

Raw response from Nautobot’s _choices endpoint.

config()

Returns config response from app

Returns:

Raw response from Nautobot’s config endpoint.

Raises:

RequestError if called for an invalid endpoint.

Example:

>>> pprint.pprint(nb.users.config())
{'tables': {'DeviceTable': {'columns': ['name',
                                        'status',
                                        'tenant',
                                        'device_role',
                                        'site',
                                        'primary_ip',
                                        'tags']}}}
get_custom_field_choices()

Returns custom-field-choices response from app

Returns:

Raw response from Nautobot’s custom-field-choices endpoint.

Raises:

RequestError if called for an invalid endpoint.

Example:

>>> nb.extras.get_custom_field_choices()
[
    {
        "id": "5b39ba88-e5ab-4be2-89f5-5a016473b53c",
        "display": "First option",
        "url": "http://localhost:8000/api/extras/custom-field-choices/5b39ba88-e5ab-4be2-89f5-5a016473b53c/",
        "field": {
            "display": "Test custom field 2",
            "id": "5b39ba88-e5ab-4be2-89f5-5a016473b53c",
            "url": "http://localhost:8000/api/extras/custom-fields/5b39ba88-e5ab-4be2-89f5-5a016473b53c/",
            "name": "test_custom_field_2"
        },
        "value": "First option",
        "weight": 100,
        "created": "2023-04-15",
        "last_updated": "2023-04-15T18:11:57.163237Z"
    },
]
get_custom_fields()

Returns custom-fields response from app

Returns:

Raw response from Nautobot’s custom-fields endpoint.

Raises:

RequestError if called for an invalid endpoint.

Example:

>>> nb.extras.get_custom_fields()
[
    {
        "id": "5b39ba88-e5ab-4be2-89f5-5a016473b53c",
        "display": "Test custom field",
        "url": "http://localhost:8000/api/extras/custom-fields/5b39ba88-e5ab-4be2-89f5-5a016473b53c/",
        "content_types": ["dcim.rack"],
        "type": {"value": "integer", "label": "Integer"},
        "label": "Test custom field",
        "name": "test_custom_field",
        "slug": "test_custom_field",
        "description": "",
        "required": False,
        "filter_logic": {"value": "loose", "label": "Loose"},
        "default": None,
        "weight": 100,
        "validation_minimum": None,
        "validation_maximum": None,
        "validation_regex": "",
        "created": "2023-04-15",
        "last_updated": "2023-04-15T17:45:11.839431Z",
        "notes_url": "http://localhost:8000/api/extras/custom-fields/5b39ba88-e5ab-4be2-89f5-5a016473b53c/notes/",
    },
]
class pynautobot.core.app.PluginsApp(api)

Bases: object

Basically valid plugins api could be handled by same App class, but you need to add plugins to request url path.

Returns:

App with added plugins into path.

__init__(api)
installed_plugins()

Returns raw response with installed plugins

Returns:

Raw response Nautobot’s installed plugins.

Example:

>>> nb.plugins.installed_plugins()
[{
    'name': 'test_plugin',
    'package': 'test_plugin',
    'author': 'Dmitry',
    'description': 'Nautobot test plugin',
    'verison': '0.10'
}]