umami-asgi


Nameumami-asgi JSON
Version 0.2.0 PyPI version JSON
download
home_pageNone
SummaryA middleware for your ASGI application that enables Umami analytics.
upload_time2024-06-21 21:11:54
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords analytics asgi asgi-middleware metrics middleware
VCS
bugtrack_url
requirements starlette httpx
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ASGI Middleware for Umami Analytics

This project provides a middleware for your
[ASGI-compatible](https://asgi.readthedocs.io/en/latest/introduction.html) app
(e.g. FastAPI, Starlette) that automatically sends access events to your
[umami](https://umami.is/) instance. If you want to track your API clients
in a GDPR-friendly way, then this middleware is for you.

## Usage

For this middleware, you need the following information:

- The URL of your Umami API (e.g. `https://umami.example.com/api`
- The website GUID (e.g. `12345678-1234-1234-1234-123456789012`)

Install the package via pip:

```bash
pip install umami-asgi
```

Then, you can add the umami middleware to your ASGI app. Here is an example for
FastAPI:

```python
from fastapi import FastAPI
from umami_asgi import UmamiMiddleware

app = FastAPI()
app.add_middleware(
    UmamiMiddleware,
    api_url="https://umami.example.com/api",
    website_id="12345678-1234-1234-1234-123456789012"
)
```

For more extensive examples, see the `examples` directory.

## Try it out

In the `examples` directory, you can find examples for FastAPI and Starlette
that you can try out easily. First, create a `.env` file in the `examples`
directory with the following content:

```text
UMAMI_API_ENDPOINT="https://example.com/api"
UMAMI_SITE_ID="your-site-id"
```

Then, install the necessary dependencies and run the example:

```bash
pip install uvicorn python-dotenv fastapi starlette 

# FastAPI:
python -m uvicorn examples.fastapi_app:app --env-file examples/.env

# Starlette:
python -m uvicorn examples.starlette_app:app --env-file examples/.env
```

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
for details.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "umami-asgi",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "analytics, asgi, asgi-middleware, metrics, middleware",
    "author": null,
    "author_email": "Kai Anter <kai@anter.dev>",
    "download_url": "https://files.pythonhosted.org/packages/9c/5e/f51a754e9a6245e06b7a653076a453af59438dd0187d0a82d3ceb293b8a2/umami_asgi-0.2.0.tar.gz",
    "platform": null,
    "description": "# ASGI Middleware for Umami Analytics\n\nThis project provides a middleware for your\n[ASGI-compatible](https://asgi.readthedocs.io/en/latest/introduction.html) app\n(e.g. FastAPI, Starlette) that automatically sends access events to your\n[umami](https://umami.is/) instance. If you want to track your API clients\nin a GDPR-friendly way, then this middleware is for you.\n\n## Usage\n\nFor this middleware, you need the following information:\n\n- The URL of your Umami API (e.g. `https://umami.example.com/api`\n- The website GUID (e.g. `12345678-1234-1234-1234-123456789012`)\n\nInstall the package via pip:\n\n```bash\npip install umami-asgi\n```\n\nThen, you can add the umami middleware to your ASGI app. Here is an example for\nFastAPI:\n\n```python\nfrom fastapi import FastAPI\nfrom umami_asgi import UmamiMiddleware\n\napp = FastAPI()\napp.add_middleware(\n    UmamiMiddleware,\n    api_url=\"https://umami.example.com/api\",\n    website_id=\"12345678-1234-1234-1234-123456789012\"\n)\n```\n\nFor more extensive examples, see the `examples` directory.\n\n## Try it out\n\nIn the `examples` directory, you can find examples for FastAPI and Starlette\nthat you can try out easily. First, create a `.env` file in the `examples`\ndirectory with the following content:\n\n```text\nUMAMI_API_ENDPOINT=\"https://example.com/api\"\nUMAMI_SITE_ID=\"your-site-id\"\n```\n\nThen, install the necessary dependencies and run the example:\n\n```bash\npip install uvicorn python-dotenv fastapi starlette \n\n# FastAPI:\npython -m uvicorn examples.fastapi_app:app --env-file examples/.env\n\n# Starlette:\npython -m uvicorn examples.starlette_app:app --env-file examples/.env\n```\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file\nfor details.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A middleware for your ASGI application that enables Umami analytics.",
    "version": "0.2.0",
    "project_urls": {
        "Homepage": "https://github.com/Tanikai/umami-asgi-middleware",
        "Issues": "https://github.com/Tanikai/umami-asgi-middleware/issues"
    },
    "split_keywords": [
        "analytics",
        " asgi",
        " asgi-middleware",
        " metrics",
        " middleware"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "06ba6ac191cab558443d331ff8a5a6d7f07cdb279167aa2ce3d5c43a0a5b6e02",
                "md5": "ff957beb7d75497dfec30752c6a750b4",
                "sha256": "db5c894770b0e31118c7eb0b9dbe1b71f9f07eb038eec3520cdb176af61b2be7"
            },
            "downloads": -1,
            "filename": "umami_asgi-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ff957beb7d75497dfec30752c6a750b4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 5227,
            "upload_time": "2024-06-21T21:11:53",
            "upload_time_iso_8601": "2024-06-21T21:11:53.072732Z",
            "url": "https://files.pythonhosted.org/packages/06/ba/6ac191cab558443d331ff8a5a6d7f07cdb279167aa2ce3d5c43a0a5b6e02/umami_asgi-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9c5ef51a754e9a6245e06b7a653076a453af59438dd0187d0a82d3ceb293b8a2",
                "md5": "dd117092b5a9a42906b57756d68d6d3f",
                "sha256": "d1f9d7c414bb4b496c44cbaeba33cab4134dacdefb355402e988395adaf74ba2"
            },
            "downloads": -1,
            "filename": "umami_asgi-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "dd117092b5a9a42906b57756d68d6d3f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 8300,
            "upload_time": "2024-06-21T21:11:54",
            "upload_time_iso_8601": "2024-06-21T21:11:54.409220Z",
            "url": "https://files.pythonhosted.org/packages/9c/5e/f51a754e9a6245e06b7a653076a453af59438dd0187d0a82d3ceb293b8a2/umami_asgi-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-21 21:11:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Tanikai",
    "github_project": "umami-asgi-middleware",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "starlette",
            "specs": []
        },
        {
            "name": "httpx",
            "specs": []
        }
    ],
    "lcname": "umami-asgi"
}
        
Elapsed time: 0.29359s