About 50 results
Open links in new tab
  1. python - How to create a FastAPI endpoint that can accept either …

    Dec 31, 2024 · 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, …

  2. Python: FastAPI error 422 with POST request when sending JSON …

    Jan 27, 2020 · Below are given various approaches on how to define a FastAPI endpoint that is expecting JSON data. Also, Python and JavaScript HTTP client examples are provided, in …

  3. python - How can I install fastapi properly? - Stack Overflow

    Dec 26, 2021 · 0 When you install with pip install "fastapi[standard]" it comes with some default optional standard dependencies.

  4. How to log raw HTTP request/response in FastAPI?

    Oct 22, 2021 · We are writing a web service using FastAPI that is going to be hosted in Kubernetes. For auditing purposes, we need to save the raw JSON body of the …

  5. Python FastAPI base path control - Stack Overflow

    Dec 3, 2021 · 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 …

  6. How to customize error response in FastAPI? - Stack Overflow

    Feb 2, 2022 · 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 …

  7. FastAPI python: How to run a thread in the background?

    Jan 27, 2022 · I'm making a server in python using FastAPI, and I want a function that is not related to my API, to run in the background every 5 minutes (like checking stuff from an API …

  8. How to initialize a global object or variable and reuse it in every ...

    from fastapi import FastAPI, Request from contextlib import asynccontextmanager @asynccontextmanager async def lifespan(app: FastAPI): ''' Run at startup Initialize the Client …

  9. ModuleNotFoundError: No module named 'fastapi' - Stack Overflow

    Feb 14, 2022 · Here is my file structure and requirements.txt: Getting ModuleNotFoundError, any help will be appreciated. main.py from fastapi import FastAPI from .import models from …

  10. What are the best practices for structuring a FastAPI project?

    Nov 21, 2020 · The problem that I want to solve related the project setup: Good names of directories so that their purpose is clear. Keeping all project files (including virtualenv) in one …