Top "Fastapi" questions

FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.6+ based on standard Python type hints.

How do I return an image in fastAPI?

Using the python module fastAPI, I can't figure out how to return an image. In flask I would do something …

python api fastapi
Python: FastAPI error 422 with post request

I'm building a simple API to test a database. When I use get request everything works fine, but if I …

python python-requests axios fastapi
FastAPI throws an error (Error loading ASGI app. Could not import module "api")

I tried to run FastAPI using uvicorn webserver but it throws an error. I run this command, uvicorn api:app …

python fastapi uvicorn
How to call an api from another api in fastapi?

I was able to get the response of one API from another but unable to store it somewhere(in a …

python python-3.x callback fastapi starlette
How to serve static files in FastAPI

I am trying to serve static files that I have in a package_docs directory. When I open in the …

python-3.x routes static-files fastapi pkg-resources
fastapi form data with pydantic model

I am trying to submit data from html forms and on the validate it with pydantic model. Using this code …

python fastapi pydantic
FastAPI: how to read body as any valid json?

Sorry, not proficient in Python. I haven't found the docs for that use case. How can I get the request …

json fastapi pydantic
Upload file using fastapi

I am using fastapi to upload file according to the official doc, just like: @app.post("/create_file/") async def …

python file-upload fastapi
How to start a Uvicorn + FastAPI in background when testing with PyTest

I have an REST-API app written with Uvicorn+FastAPI Which I want to test using PyTest. I want to start …

python testing pytest fastapi uvicorn
ASGI 'lifespan' protocol appears unsupported

I have an asynchronous code running on fastapi & aiofiles i'm trying to load and save my info from a .…

python python-asyncio fastapi python-aiofiles