About 10,000,000 results
Open links in new tab
  1. Python: FastAPI error 422 with POST request when sending JSON data

    Jan 27, 2020 · Also, note that FastAPI/Starlette uses the standard json library for parsing the data behind the scenes. If one is looking for a faster alternative, please have a look at this answer that …

  2. python - How to create a FastAPI endpoint that can accept either File ...

    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, or detect which type …

  3. 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 and printing stuff …

  4. 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.

  5. FastAPI StreamingResponse not streaming with generator function

    Mar 15, 2023 · from fastapi import FastAPI from fastapi.responses import StreamingResponse import asyncio app = FastAPI() async def fake_data_streamer(): for i in range(10): yield b'some fake …

  6. 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 others I define, to …

  7. 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 and …

  8. Python FASTAPI shedule task - Stack Overflow

    Jul 22, 2022 · 10 I want to write a task that will only run once a day at 3:30 p.m. with Python FASTAPI. How can I do it? I tried this but it works all the time.

  9. Performance results differ between run_in_threadpool () and run_in ...

    Mar 28, 2024 · Using run_in_threadpool() FastAPI is fully compatible with (and based on) Starlette, and hence, with FastAPI you get all of Starlette's features, such as run_in_threadpool(). Starlette's …

  10. How to return data in JSON format using FastAPI?

    Oct 6, 2022 · FastAPI (actually Starlette) will automatically include a Content-Length header. It will also include a Content-Type header, based on the media_type and appending a charset for text types. …