utilities/constants.py

netbox · netbox/utilities/constants.py · python · Apache-2.0
integration, Integration / API

Provides constants for NetBox filters, HTML sanitization, and HTTP request handling utilities.

# Source: https://github.com/netbox-community/netbox | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
# Provided via justclaw.it.com; keep this notice with the code.
#
# Filter lookup expressions
#

FILTER_CHAR_BASED_LOOKUP_MAP = dict(
    n='exact',
    ic='icontains',
    nic='icontains',
    iew='iendswith',
    niew='iendswith',
    isw='istartswith',
    nisw='istartswith',
    ie='iexact',
    nie='iexact',
    empty='empty',
    regex='regex',
    iregex='iregex',
)

# A member is a scalar inside a stored array, so negation cannot fall back to equality
FILTER_ARRAY_BASED_LOOKUP_MAP = {
    **FILTER_CHAR_BASED_LOOKUP_MAP,
    'n': 'contains',
}

FILTER_NUMERIC_BASED_LOOKUP_MAP = dict(
    n='exact',
    lte='lte',
    lt='lt',
    gte='gte

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key