FastAPI middleware to redirect spam requests to a random 10 hours of video. Ported from django-spam (I'm the creator), which was inspired by this Nick Craver Tweet from 2018.
pip install fastapi-spam
Add the TenHoursOfRedirect
middleware to your FastAPI app (or Starlette).
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!