About 8,780,000 results
Open links in new tab
  1. 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 …

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

  3. fastapi @app.on_event decorator is deprecated, how can I create a ...

    Feb 22, 2024 · I have the following decorator that works perfectly, but fastapi says @app.on_event ("startup") is deprecated, and I'm unable to get @repeat_every () to work with …

  4. FastAPI - How to get app instance inside a router?

    Since FastAPI is actually Starlette underneath, you could store the model on the application instance using the generic app.state attribute, as described in Starlette's documentation (see …

  5. FastAPI / uvicorn (or hypercorn): where is my root-path?

    As described in the documentation: When you mount a sub-application as described above, FastAPI will take care of communicating the mount path for the sub-application using a …

  6. How to add both file and JSON body in a FastAPI POST request?

    Dec 30, 2020 · Whenever a new request arrives, FastAPI will take care of calling your dependency, getting the result and assigning that result to the parameter (e.g., base) in your …

  7. How to create routes with FastAPI within a class

    Sep 11, 2020 · This would likely add a lot of complexity to FastAPI and is a use case that FastAPI devs (understandably) don't seem interested in supporting. It seems the recommended way of …

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

  9. How to configure FastAPI logging so that it works both with …

    Aug 29, 2023 · 1. Setting up the uvicorn logger Straight from the documentation: Logging --log-config <path> - Logging configuration file. Options: dictConfig() formats: .json, . yaml. Any …

  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 …