NexusConfig
SDK configuration.
from nexus import NexusConfigSDK 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
classEverything 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>.
http_base
propertyhttp_base: strThe API origin without a trailing slash.
View sourcesocket_base
propertysocket_base: strThe Socket.IO origin (realtime_url or the API origin).
resolved_user_agent
propertyresolved_user_agent: strservice_enabled()
methoddef service_enabled(service) -> boolWhether a product is switched on (code + NEXUS_<SERVICE>_ENABLED, off wins).
Parameters
Prop
Type
Returns bool
url_for()
methoddef url_for(path) -> strParameters
Prop
Type
Returns str
with_()
methoddef with_(**changes) -> 'NexusConfig'A copy with some fields changed.
Parameters
Prop
Type
Returns 'NexusConfig'
from_mapping()
methoddef 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'
create()
methoddef 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'
from_env()
methoddef 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'
