コンテンツにスキップ
per page, with , order by , clip by
Results of 1 - 10 of about 24 for Use case (0.003 sec.)
use (78), case (25)
GraphQL 21689
GraphQL Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . As FastAPI is based on the ASGI standard, it's very easy to integrate any GraphQL library also compatible w ... You can combine normal FastAPI path operations with GraphQL on the same application. Tip GraphQL solves some very specific use cases. It has advantages and disadvantages when compared to common web APIs . Make sure you evaluate if the benefits for y ... our use case compensate the drawbacks . ? GraphQL Libraries Here are some of the GraphQL libraries that have ASGI support. You cou ... ended library as it has the design closest to FastAPI's design, it's all based on type annotations . Depending on your use case, you might prefer to use a different library, but if you asked me, I would probably suggest you try Strawberry . Here's a ...
https://man.mtool.work/fastapi/0.115/how-to/graphql/
Virtual Environments 20619
Virtual Environments Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . When you work in Python projects you probably should use a virtual environment (or a similar m ... ate the packages you install for each project. Info If you already know about virtual environments, how to create them and use them, you might want to skip this section. ? Tip A virtual environment is different than an environment variable . An envi ... ronment variable is a variable in the system that can be used by programs. A virtual environment is a directory with some files in it. Info This page will teach you how to use virtual ... /code/awesome-project/.venv/bin/python If it shows the python binary at .venv/bin/python , inside of your project (in this case awesome-project ), then it worked. ? $ Get-Command python C:\Users\user\code\awesome-project\.venv\Scripts\python If it sh ...
https://man.mtool.work/fastapi/0.115/virtual-environments/
Lifespan Events 19904
Lifespan Events Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . You can define logic (code) that should be executed before the application starts up . This means t ... quests . The same way, you can define logic (code) that should be executed when the application is shutting down . In this case, this code will be executed once , after having handled possibly many requests . Because this code is executed before the ... requests, it covers the whole application lifespan (the word "lifespan" will be important in a second ?). This can be very useful for setting up resources that you need to use for the whole app, and that are shared among requests, and/or that you ne ... ed to clean up afterwards. For example, a database connection pool, or loading a shared machine learning model. Use Case Let's start with an example use case and then see how to solve it with this. Let's imagine that you have some machine ...
https://man.mtool.work/fastapi/0.115/advanced/events/
Behind a Proxy 18998
Behind a Proxy Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . In some situations, you might need to use a proxy server like Traefik or Nginx with a configuration ... that adds an extra path prefix that is not seen by your application. In these cases you can use root_path to configure your application. The root_path is a mechanism provided by the ASGI specification (tha ... t FastAPI is built on, through Starlette). The root_path is used to handle these specific cases. And it's also used internally when mounting sub-applications. Proxy with a stripped path ... prefix Having a proxy with a stripped path prefix, in this case, means that you could declare a path at /app in your code, but then, you add a layer on top (the proxy) that would put you ...
https://man.mtool.work/fastapi/0.115/advanced/behind-a-proxy/
Settings and Environment Variables 18027
Settings and Environment Variables Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . In many cases your application could need some external settings or configuratio ... same way as with Pydantic models, you declare class attributes with type annotations, and possibly default values. You can use all the same validation features and tools you use for Pydantic models, like different data types and additional validatio ... c_settings import BaseSettings class Settings ( BaseSettings ): app_name : str = "Awesome API" admin_email : str items_per_user : int = 50 settings = Settings () app = FastAPI () @app . get ( "/info" ) async def info (): return { "app_name" : settin ... d paste, don't use this example, use the last one below. Then, when you create an instance of that Settings class (in this case, in the settings object), Pydantic will read the environment variables in a case-insensitive way, so, an upper-case variab ...
https://man.mtool.work/fastapi/0.115/advanced/settings/
Using Dataclasses 17726
Using Dataclasses Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . FastAPI is built on top of Pydantic , and I have been showing you how to use Pydantic models to d ... till supported thanks to Pydantic , as it has internal support for dataclasses . So, even with the code above that doesn't use Pydantic explicitly, FastAPI is using Pydantic to convert those standard dataclasses to Pydantic's own flavor of dataclass ... using Pydantic. Info Keep in mind that dataclasses can't do everything Pydantic models can do. So, you might still need to use Pydantic models. But if you have a bunch of dataclasses laying around, this is a nice trick to use them to power a web API ... ested Data Structures You can also combine dataclasses with other type annotations to make nested data structures. In some cases, you might still have to use Pydantic's version of dataclasses . For example, if you have errors with the automatically g ...
https://man.mtool.work/fastapi/0.115/advanced/dataclasses/
OpenAPI 17677
OpenAPI There are several utilities to handle OpenAPI. You normally don't need to use them unless you have a specific advanced use case that requires it. ...
https://man.mtool.work/fastapi/0.115/reference/openapi/
Repository Management Tasks 17299
Repository Management Tasks These are the tasks that can be performed to manage the FastAPI repository by team members . Tip This section is useful only to a handful of people, team members with permissions to manage the repository. You can ... rested in the project, or for having dedicated some time to try to do something. It's difficult to convey emotion in text, use emojis to help. ? In discussions and PRs, in many cases, people bring their frustration and show it without filter, in man ... y cases exaggerating, complaining, being entitled, etc. That's really not nice, and when it happens, it lowers our priority to so ... , you can ask me (@tiangolo) to handle it directly. Edit PR Titles Edit the PR title to start with an emoji from gitmoji . Use the emoji character, not the GitHub code. So, use ? instead of :bug: . This is so that it shows up correctly outside of Gi ...
https://man.mtool.work/fastapi/0.115/management-tasks/
Advanced Dependencies 16173
Advanced Dependencies Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . Parameterized dependencies All the dependencies we have seen are a fixed function or class. B ... ut there could be cases where you want to be able to set parameters on the dependency, without having to declare many different functions or clas ... ded : Annotated [ bool , Depends ( checker )]): return { "fixed_content_in_query" : fixed_content_included } Tip Prefer to use the Annotated version if possible. from fastapi import Depends , FastAPI app = FastAPI () class FixedContentQueryChecker : ... fixed_content_included : bool = Depends ( checker )): return { "fixed_content_in_query" : fixed_content_included } In this case, this __call__ is what FastAPI will use to check for additional parameters and sub-dependencies, and this is what will be ...
https://man.mtool.work/fastapi/0.115/advanced/advanced-dependencies/
Simple OAuth2 with Password and Bearer 16172
Simple OAuth2 with Password and Bearer Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . Now let's build from the previous chapter and add the missing parts to have ... a complete security flow. Get the username and password We are going to use FastAPI security utilities to get the username and password . OAuth2 specifies that ... when using the "password flow" (that we are using) the client/user must send a username and password fields as form data. And the spec says that the fields have to be named like that. So u ... ndency that you could have written yourself, or you could have declared Form parameters directly. But as it's a common use case, it is provided by FastAPI directly, just to make it easier. Use the form data Tip The instance of the dependency class OA ...
https://man.mtool.work/fastapi/0.115/tutorial/security/simple-oauth2/
PREV 1 2 3 NEXT