Class issues. fastapi registers self as a query parameter. #10860
Replies: 2 comments
-
|
In general, the problem is solved if you make login and ValidateUser functions, for example inside init. But it doesn't seem to be the best solution. |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
I think you can solve this using Let's close this for now to keep the discussions clean and organized. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
First Check
Commit to Help
Example Code
Description
I want to use a class based view, but not quite in the standard way. In my case, the custom class should fully serve the server controlling the device so that it can be used as an embedded module if needed.
I have previously discovered #2220
But it seems the solution presented there is not suitable for me.
I am using APIRouter and add_api_route, and when I add a POST method using Depend I get that the self argument of my custom class is registered as a request parameter.
Operating System
Windows
Operating System Details
No response
FastAPI Version
0.108.0
Pydantic Version
2.5.3
Python Version
3.11.3
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions