Global web icon
stackoverflow.com
https://stackoverflow.com/questions/74009210/how-t…
python - How to create a FastAPI endpoint that can accept either File ...
8 I would like to create an endpoint in FastAPI that might receive either multipart/form-data or JSON body. Is there a way I can make such an endpoint accept either, or detect which type of data is receiving?
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/79522677/how-t…
How to pass an argument to a 'dependencies' function in FastAPI?
The FastAPI Advanced Dependencies guide has a couple examples, specifically oriented around classes. But in your example, so long as verify_token("red") returns a callable with the right syntax and type annotations, FastAPI can use it as a dependency. The easy way is to have the function return another function:
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/70219200/pytho…
Python FastAPI base path control - Stack Overflow
When I use FastAPI , how can I sepcify a base path for the web-service? To put it another way - are there arguments to the FastAPI object that can set the end-point and any others I define, to a different root path?
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/77362216/add-s…
Add startup/shutdown handlers to FastAPI app with lifespan API
app.mount(mount_path, sub_app) How can I register startup/shutdown handlers for the sub app? All solutions I could find either require control over the lifespan generator (which I don't have) or involve deprecated methods like add_event_handler (which doesn't work when lifespan is set).
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/79694234/does-…
python - Does FastAPI still need Gunicorn? - Stack Overflow
Shortly after, FastAPI’s creator deprecated the tiangolo/uvicorn-gunicorn-fastapi Docker image, stating: Now that Uvicorn supports managing workers with --workers, including restarting dead ones, there's no need for Gunicorn. Starting with FastAPI 0.110, the fastapi run CLI is just a thin wrapper around this new Uvicorn supervisor.
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/70486911/how-c…
python - How can I install fastapi properly? - Stack Overflow
0 When you install with pip install "fastapi[standard]" it comes with some default optional standard dependencies.
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/62856818/how-c…
How can I run the FastAPI server using Pycharm? - Stack Overflow
uvicorn main:app Since we are not calling any python file directly, it is not possible to call uvicorn command from Pycharm. So, How can I run the fast-api server using Pycharm?
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/70952692/how-t…
How to customize error response in FastAPI? - Stack Overflow
I tried to put the line app=FastAPI() in a try-catch block, however, it doesn't work. Is there any way I can handle this issue with own response instead of the above mentioned auto response?
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/69641363/how-t…
How to run FastAPI app on multiple ports? - Stack Overflow
I have a FastAPI application that I am running on port 30000 using Uvicorn programmatically. Now I want to run the same application on port 8443 too. The same application needs to run on both these...
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/63667466/video…
Video Streaming App using FastAPI and OpenCV - Stack Overflow
Below are given two options (with complete code samples) on how to stream (live) video using FastAPI and OpenCV. Option 1 demonstrates an approach based on your question using the HTTP protocol and FastAPI/Starlette's StreamingResponse.