InvergeDocs
PythonAPI reference

AsyncNexusClient

The asynchronous Nexus client — same surface, `await`-ed.

from nexus.aio import AsyncNexusClient

The asynchronous Nexus client — same surface, await-ed.

from nexus.aio import AsyncNexusClient

nexus = AsyncNexusClient("nxs_live_xxx")

await nexus.identify("user_123", email="a@b.com")
nexus.events.track("order_placed", {"total": 42})      # buffered, no await
await nexus.realtime.emit("orders:42", "status", {"state": "shipped"})
await nexus.aclose()

Buffered telemetry (events.track / logs.info) stays synchronous — it only appends to a buffer — while everything that talks to the network is a coroutine. Build one client per process and close it on shutdown.

AsyncNexusClient

class

An asyncio-native connection to one Nexus environment.

View source

AsyncNexusClient

constructor
AsyncNexusClient(api_key=None, *, config=None, transport=None, **options)

Parameters

Prop

Type

View source

distinct_id

property
distinct_id: Optional[str]
View source

session_key

property
session_key: Optional[str]
View source

pending

property
pending: int
View source

closed

property
closed: bool
View source

identify()

method
async def identify(distinct_id, *, email=None, name=None, phone=None, traits=None, remote=True, **context_fields) -> Dict[str, Any]

Bind the user to this task's context and upsert them server-side.

Parameters

Prop

Type

Returns Dict[str, Any]

View source

reset()

method
def reset() -> None
View source

current_distinct_id()

method
def current_distinct_id() -> Optional[str]

Returns Optional[str]

View source

ambient_properties()

method
def ambient_properties() -> Mapping[str, Any]

Returns Mapping[str, Any]

View source

resolve_context()

method
def resolve_context(**overrides) -> Dict[str, Any]

Config defaults < ambient context < explicit overrides (camelCase).

Parameters

Prop

Type

Returns Dict[str, Any]

View source

request()

method
async def request(request) -> Any

Execute one partner-API request (raises unless silent).

Parameters

Prop

Type

Returns Any

View source

enabled()

method
def enabled(service) -> bool

Whether a product is switched on — services / NEXUS_<SERVICE>_ENABLED.

Parameters

Prop

Type

Returns bool

View source

enqueue_event()

method
def enqueue_event(item, context) -> None

Parameters

Prop

Type

View source

enqueue_log()

method
def enqueue_log(item, context) -> None

Parameters

Prop

Type

View source

flush_events()

method
async def flush_events() -> None
View source

flush_logs()

method
async def flush_logs() -> None
View source

flush()

method
async def flush() -> None

Ship everything buffered right now.

View source

track()

method
def track(name, properties=None, **kwargs) -> None

Parameters

Prop

Type

View source

capture_exception()

method
async def capture_exception(exc=None, **options) -> Dict[str, Any]

Parameters

Prop

Type

Returns Dict[str, Any]

View source

emit()

method
async def emit(room, events, payload=None) -> Dict[str, Any]

Parameters

Prop

Type

Returns Dict[str, Any]

View source

is_enabled()

method
async def is_enabled(key, distinct_id=None, **kwargs) -> bool

Parameters

Prop

Type

Returns bool

View source

aclose()

method
async def aclose() -> None

Flush, stop the background tasks and close the transport.

View source

On this page