`request` parameter unable to be renamed
Opened this issue · 1 comments
Describe the bug
Right now any rate limited endpoints need to be provided the request
parameter to function properly per the docs. It's not currently possible to rename this parameter to anything other than request
. If a type hint of Request
is provided for the parameter, it should be be allowed to be named _
for example so that we can avoid linter errors saying Parameter 'request' is not used
To Reproduce
@app.post('/v0/login')
@limiter.limit('5/hour')
def _serve_login_endpoint(
request: Request, # This throws a linter error with ruff `Parameter 'request' value is not used`
...):
...
Renaming the request
parameter to _
raises on exception Exception: No "request" or "websocket" argument on function "<function _serve_login_endpoint at 0x76e2501042c0>"
Expected behavior
@app.post('/v0/login')
@limiter.limit('5/hour')
def _serve_login_endpoint(
_: Request,
...):
...
Renaming the request
parameter to _
and providing a type hint of Request
should not throw the above exception.
Your app (please complete the following information):
- fastapi: 0.110.0
- slowapi: 0.1.9
I have not actively contributed to this repo before, but was perusing it and will take a stab