InvergeDocs
PythonAPI reference

NexusConfig

SDK configuration.

from nexus import NexusConfig

SDK configuration.

NexusConfig is an immutable value object. Build it explicitly, from a mapping (from_mapping — handy for Django's settings.NEXUS), or from the environment (from_env).

NexusConfig

class

Everything the client needs to talk to Nexus.

Args: api_key: Tenant API key (nxs_...). Required. It is scoped to one environment; every write lands in that environment. base_url: API origin. Point it at a local backend while developing. realtime_url: Socket.IO origin for nexus.realtime_socket. Defaults to base_url. timeout: Per-request timeout in seconds. max_retries: Retries for safe requests (telemetry ingest, reads) on network errors, 429 and 5xx. Non-idempotent calls (push sends, voice control, realtime emits) are never retried. retry_backoff: Base delay in seconds; doubles per attempt. default_headers: Extra headers merged into every request. app_version / release / os_type / os_version: Default telemetry context, attached to events, logs and errors unless overridden per call. default_properties: Merged into the properties of every captured event. batch: Buffer events and logs and ship them on a background thread. Keeps telemetry off your request's hot path. Turn it off in short scripts and serverless functions if you prefer explicit sends (nexus.NexusClient.flush works either way). flush_interval: Seconds between background flushes. max_batch: Maximum items per batched request. max_queue: Buffer capacity; items beyond it are dropped (and counted) rather than growing memory without bound. silent: Never let a Nexus failure reach your code. Direct calls return None/empty instead of raising, and the failure is logged to the nexus logger. Background delivery is always silent. debug: Verbose SDK logging on the nexus logger. user_agent: Overrides the default inverge-nexus-python/<version>.

View source

http_base

property
http_base: str

The API origin without a trailing slash.

View source

socket_base

property
socket_base: str

The Socket.IO origin (realtime_url or the API origin).

View source

resolved_user_agent

property
resolved_user_agent: str
View source

service_enabled()

method
def service_enabled(service) -> bool

Whether a product is switched on (code + NEXUS_<SERVICE>_ENABLED, off wins).

Parameters

Prop

Type

Returns bool

View source

url_for()

method
def url_for(path) -> str

Parameters

Prop

Type

Returns str

View source

with_()

method
def with_(**changes) -> 'NexusConfig'

A copy with some fields changed.

Parameters

Prop

Type

Returns 'NexusConfig'

View source

from_mapping()

method
def from_mapping(options, api_key=None) -> 'NexusConfig'

Build from a plain dict.

Keys may be snake_case (base_url) or the camelCase spellings used by the other Nexus SDKs (baseUrl) — both are accepted, so a shared config blob can drive any of them. Unknown keys are ignored.

Parameters

Prop

Type

Returns 'NexusConfig'

View source

create()

method
def create(api_key=None, environ=None, **options) -> 'NexusConfig'

Explicit options layered over the NEXUS_* environment.

This is what the clients use: settings you don't pass in code (a timeout, retries, batching) can still come from the environment. Precedence, lowest first: environment → options → api_key.

Parameters

Prop

Type

Returns 'NexusConfig'

View source

from_env()

method
def from_env(environ=None, **overrides) -> 'NexusConfig'

Build purely from NEXUS_* environment variables.

Recognised: NEXUS_API_KEY (required), NEXUS_BASE_URL, NEXUS_REALTIME_URL, NEXUS_TIMEOUT, NEXUS_MAX_RETRIES, NEXUS_APP_VERSION, NEXUS_RELEASE, NEXUS_BATCH, NEXUS_FLUSH_INTERVAL, NEXUS_MAX_BATCH, NEXUS_SILENT, NEXUS_DEBUG. Keyword overrides win over the environment.

Parameters

Prop

Type

Returns 'NexusConfig'

View source

On this page