fastapi-spam


Namefastapi-spam JSON
Version 0.0.4 PyPI version JSON
download
home_pageNone
SummaryFastAPI middleware to redirect spam requests to a random 10 hours of video
upload_time2025-08-01 03:59:00
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseNone
keywords python package packaging fastapi spam middleware
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <p align="center">
    <a href="https://github.com/nickatnight/fastapi-spam/actions">
        <img alt="GitHub Actions status" src="https://github.com/nickatnight/fastapi-spam/actions/workflows/main.yaml/badge.svg">
    </a>
    <a href="https://codecov.io/gh/nickatnight/fastapi-spam">
        <img alt="Coverage" src="https://codecov.io/gh/nickatnight/fastapi-spam/branch/main/graph/badge.svg?token=FUZyqlCbbl"/>
    </a>
    <a href="https://pypi.org/project/fastapi-spam/">
        <img alt="PyPi Shield" src="https://img.shields.io/pypi/v/fastapi-spam">
    </a>
    <a href="https://docs.astral.sh/uv/">
        <img alt="uv version" src="https://img.shields.io/badge/uv-0.7.18+-purple">
    </a>
    <a href="https://www.python.org/downloads/">
        <img alt="Python Versions Shield" src="https://img.shields.io/badge/Python-3.9+-blue?logo=python&logoColor=white">
    </a>
    <a href="https://github.com/nickatnight/fastapi-spam/blob/master/LICENSE">
        <img alt="License Shield" src="https://img.shields.io/github/license/nickatnight/fastapi-spam">
    </a>
</p>

# 🍔 fastapi-spam

FastAPI middleware to redirect spam requests to a random 10 hours of video. Ported from [django-spam](https://github.com/Tivix/django-spam) (I'm the creator), which was inspired by this [Nick Craver Tweet](https://twitter.com/nick_craver/status/720062942960623616) from 2018.

## Installation

```bash
pip install fastapi-spam
```

## Usage

Add the `TenHoursOfRedirect` middleware to your FastAPI app (or Starlette).

```python
from fastapi import FastAPI

from fastapi_spam.middleware import TenHoursOfRedirect


app = FastAPI()

...

app.add_middleware(TenHoursOfRedirect)
```

Now, any time an intruder tries to access an endpoint in `SPAM_ROUTES`, they will be redirected to a random 10 hours of video...take that bots!

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "fastapi-spam",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "Python, package, packaging, FastAPI, Spam, Middleware",
    "author": null,
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/e3/13/2f578ab0adc2c1dacdeecb52d12c4753227455c424d20f3a8f649787d559/fastapi_spam-0.0.4.tar.gz",
    "platform": null,
    "description": "<p align=\"center\">\n    <a href=\"https://github.com/nickatnight/fastapi-spam/actions\">\n        <img alt=\"GitHub Actions status\" src=\"https://github.com/nickatnight/fastapi-spam/actions/workflows/main.yaml/badge.svg\">\n    </a>\n    <a href=\"https://codecov.io/gh/nickatnight/fastapi-spam\">\n        <img alt=\"Coverage\" src=\"https://codecov.io/gh/nickatnight/fastapi-spam/branch/main/graph/badge.svg?token=FUZyqlCbbl\"/>\n    </a>\n    <a href=\"https://pypi.org/project/fastapi-spam/\">\n        <img alt=\"PyPi Shield\" src=\"https://img.shields.io/pypi/v/fastapi-spam\">\n    </a>\n    <a href=\"https://docs.astral.sh/uv/\">\n        <img alt=\"uv version\" src=\"https://img.shields.io/badge/uv-0.7.18+-purple\">\n    </a>\n    <a href=\"https://www.python.org/downloads/\">\n        <img alt=\"Python Versions Shield\" src=\"https://img.shields.io/badge/Python-3.9+-blue?logo=python&logoColor=white\">\n    </a>\n    <a href=\"https://github.com/nickatnight/fastapi-spam/blob/master/LICENSE\">\n        <img alt=\"License Shield\" src=\"https://img.shields.io/github/license/nickatnight/fastapi-spam\">\n    </a>\n</p>\n\n# \ud83c\udf54 fastapi-spam\n\nFastAPI middleware to redirect spam requests to a random 10 hours of video. Ported from [django-spam](https://github.com/Tivix/django-spam) (I'm the creator), which was inspired by this [Nick Craver Tweet](https://twitter.com/nick_craver/status/720062942960623616) from 2018.\n\n## Installation\n\n```bash\npip install fastapi-spam\n```\n\n## Usage\n\nAdd the `TenHoursOfRedirect` middleware to your FastAPI app (or Starlette).\n\n```python\nfrom fastapi import FastAPI\n\nfrom fastapi_spam.middleware import TenHoursOfRedirect\n\n\napp = FastAPI()\n\n...\n\napp.add_middleware(TenHoursOfRedirect)\n```\n\nNow, any time an intruder tries to access an endpoint in `SPAM_ROUTES`, they will be redirected to a random 10 hours of video...take that bots!\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "FastAPI middleware to redirect spam requests to a random 10 hours of video",
    "version": "0.0.4",
    "project_urls": {
        "Homepage": "https://github.com/nickatnight/fastapi-spam",
        "Issues": "https://github.com/nickatnight/fastapi-spam/issues"
    },
    "split_keywords": [
        "python",
        " package",
        " packaging",
        " fastapi",
        " spam",
        " middleware"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "31427e38ba2f155ba3258d233b944b33553b737006aeb994792f4cafbcb8c40d",
                "md5": "9fcf906c1d840d70819fb1d4f1cdd89a",
                "sha256": "473cd9beb0c51be06c8905728208c91aa893012472a27f67d195f83020cb664f"
            },
            "downloads": -1,
            "filename": "fastapi_spam-0.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9fcf906c1d840d70819fb1d4f1cdd89a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 4910,
            "upload_time": "2025-08-01T03:58:59",
            "upload_time_iso_8601": "2025-08-01T03:58:59.156934Z",
            "url": "https://files.pythonhosted.org/packages/31/42/7e38ba2f155ba3258d233b944b33553b737006aeb994792f4cafbcb8c40d/fastapi_spam-0.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "e3132f578ab0adc2c1dacdeecb52d12c4753227455c424d20f3a8f649787d559",
                "md5": "3caf601d715eb2ba7d8ec245d9573614",
                "sha256": "f5ca474c12dda04267f335d13894e1eb98aec49acc7627d41328e75e2a369b78"
            },
            "downloads": -1,
            "filename": "fastapi_spam-0.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "3caf601d715eb2ba7d8ec245d9573614",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 5318,
            "upload_time": "2025-08-01T03:59:00",
            "upload_time_iso_8601": "2025-08-01T03:59:00.210489Z",
            "url": "https://files.pythonhosted.org/packages/e3/13/2f578ab0adc2c1dacdeecb52d12c4753227455c424d20f3a8f649787d559/fastapi_spam-0.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-01 03:59:00",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "nickatnight",
    "github_project": "fastapi-spam",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "fastapi-spam"
}
        
Elapsed time: 2.88351s