> ## Documentation Index
> Fetch the complete documentation index at: https://novu-c5de82d9-docs-homepage-redesign.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Python

> Connect a Python application to Novu

Novu's Python SDK provides simple, yet comprehensive notification management, and delivery capabilities through multiple channels that you can implement using code that integrates seamlessly with your Python application.

[Explore the source code on GitHub](https://github.com/novuhq/novu-py)

## Installation

<Tabs>
  <Tab title="PIP">
    PIP is the default package installer for Python, enabling easy installation and management of packages from PyPI via the command line.

    ```bash theme={null}
    pip install novu-py
    ```
  </Tab>

  <Tab title="Poetry">
    Poetry is a modern tool that simplifies dependency management and package publishing by using a single pyproject.toml file to handle project metadata and dependencies.

    ```bash theme={null}
    poetry add novu-py
    ```
  </Tab>

  <Tab title="Shell and script usage with uv">
    You can use this SDK in a Python shell with uv and the uvx command that comes with it like so:

    ```bash theme={null}
    uvx --from novu-py python
    ```

    It's also possible to write a standalone Python script without needing to set up a whole project like so:

    ```python theme={null}
    #!/usr/bin/env -S uv run --script
    # /// script
    # requires-python = ">=3.9"
    # dependencies = [
    #     "novu-py",
    # ]
    # ///

    from novu_py import Novu

    sdk = Novu(
      # SDK arguments
    )

    # Rest of script here...
    ```

    Once that is saved to a file, you can run it with uv run `script.py` where `script.py` can be replaced with the actual file name.
  </Tab>
</Tabs>

## Usage

<Tabs>
  <Tab title="US Region">
    <Tabs>
      <Tab title="Synchronous">
        ```python theme={null}
        import novu_py
        from novu_py import Novu
        import os

        with Novu(
        secret_key=os.getenv("NOVU_SECRET_KEY", ""),
        ) as novu:

            res = novu.trigger(trigger_event_request_dto=novu_py.TriggerEventRequestDto(
                workflow_id="workflow_identifier",
                to={
                    "subscriber_id": "subscriber_unique_identifier",
                    "first_name": "Albert",
                    "last_name": "Einstein",
                    "email": "albert@einstein.com",
                },
                payload={
                    "comment_id": "string",
                    "post": {
                        "text": "string",
                    },
                },
                overrides={
                  "email": {
                    "bcc": "no-reply@novu.co"
                  }
                },
            ))

            # Handle response
            print(res)

        ```
      </Tab>

      <Tab title="Asynchronous">
        ```python theme={null}
        import asyncio
        import novu_py
        from novu_py import Novu
        import os

        async def main():
        async with Novu(
        secret_key=os.getenv("NOVU_SECRET_KEY", ""),
        ) as novu:

                res = await novu.trigger_async(trigger_event_request_dto=novu_py.TriggerEventRequestDto(
                    workflow_id="workflow_identifier",
                    to={
                        "subscriber_id": "subscriber_unique_identifier",
                        "first_name": "Albert",
                        "last_name": "Einstein",
                        "email": "albert@einstein.com",
                    },
                    payload={
                        "comment_id": "string",
                        "post": {
                            "text": "string",
                        },
                    },
                    overrides={
                      "email": {
                        "bcc": "no-reply@novu.co",
                      }
                    },
                ))

                # Handle response
                print(res)

        asyncio.run(main())
        ```
      </Tab>
    </Tabs>
  </Tab>

  <Tab title="EU Region">
    ```python theme={null}
    import novu_py
    from novu_py import Novu
    import os

    with Novu(
    server_url="https://eu.api.novu.co",
    secret_key=os.getenv("NOVU_SECRET_KEY", ""),
    ) as novu:

        res = novu.trigger(trigger_event_request_dto=novu_py.TriggerEventRequestDto(
            workflow_id="workflow_identifier",
            to={
                "subscriber_id": "subscriber_unique_identifier",
            },
            payload={
                "comment_id": "string",
                "post": {
                    "text": "string",
                },
            },
            overrides={
              "email": {
                "bcc": "no-reply@novu.co"
              }
            },
        ))

        # Handle response
        print(res)

    ```
  </Tab>
</Tabs>

```
```
