> For the complete documentation index, see [llms.txt](https://dnotifier.gitbook.io/product-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dnotifier.gitbook.io/product-docs/getting-started/installation/python.md).

# Python

The DNotifier Python SDK is an **async-first** client for realtime messaging, chat, AI, RAG, and workflows. It runs in Python 3.9+ on servers, scripts, and async web frameworks.

## Requirements

* **Python** 3.9 or later
* **pip** (or uv, poetry, pipenv)
* DNotifier **app\_id** and **secret** from the [dashboard](https://app.dnotifier.com) — see [**Create an app**](/product-docs/getting-started/create-app.md)

## Install the package

```bash
pip install dnotifier
```

Using poetry or uv:

```bash
poetry add dnotifier
uv pip install dnotifier
```

Package on PyPI: [dnotifier](https://pypi.org/project/dnotifier/) (current release: **1.0.0**)

The package depends on **httpx** (HTTP transport and auth) and **websockets** (WebSocket transport). Both are installed automatically.

## Import the SDK

```python
from dnotifier import DNotifier, Workflow, define_agent, Payload
```

The main export exposes `DNotifier`, message types, workflow helpers, and utilities.

## Virtual environment (recommended)

```bash
python -m venv .venv
source .venv/bin/activate   # Windows: .venv\Scripts\activate
pip install dnotifier
```

## Environment configuration

Load credentials from environment variables:

```python
import os

app_id = os.environ["DNOTIFIER_APP_ID"]
secret = os.environ["DNOTIFIER_SECRET"]
```

See [**Credentials & environment**](/product-docs/getting-started/credentials.md) for full patterns.

{% hint style="warning" %}
Never commit your app **secret** to source control. Use environment variables or a secrets manager in production.
{% endhint %}

## Verify installation

Create a small script:

```python
from dnotifier import DNotifier

print(DNotifier)  # prints the DNotifier class
```

Run:

```bash
python check_install.py
```

If the import resolves without errors, installation succeeded.

## Async entry point

All SDK methods are async. Use `asyncio.run()` in scripts:

```python
import asyncio
from dnotifier import DNotifier

async def main():
    notifier = DNotifier(
        app_id="your-app-id",
        secret="your-app-secret",
        transport="http",
        user_id="user-123",
    )
    await notifier.connect()
    print("Connected:", notifier.is_connected)

asyncio.run(main())
```

## Next steps

* [**Your first connection — Python**](/product-docs/getting-started/first-connection/python.md)
* [**Your first message — Python**](/product-docs/getting-started/first-message/python.md)
* [**Choose your transport**](/product-docs/getting-started/choose-transport.md)
