App¶
pynautobot.core.app
¶
pynautobot.core.app.App
¶
Bases: object
Represents apps in Nautobot.
Calls to attributes are returned as Endpoint objects.
Returns:
Name | Type | Description |
---|---|---|
Endpoint |
Matching requested attribute. |
Raises:
Type | Description |
---|---|
RequestError
|
If requested endpoint doesn't exist. |
choices()
¶
Returns _choices response from App.
Returns:
Type | Description |
---|---|
Raw response from Nautobot's _choices endpoint. |
config()
¶
Returns config response from app.
Returns:
Name | Type | Description |
---|---|---|
dict |
Raw response from Nautobot's config endpoint. |
Raises:
Type | Description |
---|---|
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:
Type | Description |
---|---|
Raw response from Nautobot's custom-field-choices endpoint. |
Raises:
Type | Description |
---|---|
RequestError
|
If called for an invalid endpoint. |
Examples:
>>> 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:
Type | Description |
---|---|
Raw response from Nautobot's custom-fields endpoint. |
Raises:
Type | Description |
---|---|
RequestError
|
If called for an invalid endpoint. |
Examples:
>>> 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/",
},
]