Results of 1 - 10 of about 28 for operations (0.002 sec.)
- Bigger Applications - Multiple Files 13830
- Bigger Applications - Multiple Files Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . If you are building an application or a web API, it's rarely the case that you
...Let's say the file dedicated to handling just users is the submodule at /app/routers/users.py . You want to have the path operations related to your users separated from the rest of the code, to keep it organized. But it's still part of the same FastAPI a...pplication/web API (it's part of the same "Python Package"). You can create the path operations for that module using APIRouter . Import APIRouter You import it and create an "instance" the same way you would with the..."/users/ {username} " , tags = [ "users" ]) async def read_user ( username : str ): return { "username" : username } Path operations with APIRouter And then you use it to declare your path operations . Use it the same way you would use the FastAPI class:... - https://man.mtool.work/fastapi/0.115/tutorial/bigger-applications/
- Sub Applications - Mounts 11585
- Sub Applications - Mounts Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . If you need to have two independent FastAPI applications, with their own independent Open
...y "independent" application in a specific path, that then takes care of handling everything under that path, with the path operations declared in that sub-application. Top-level application First, create the main, top-level, FastAPI application, and its pa...th operations : Python 3.8+ from fastapi import FastAPI app = FastAPI () @app . get ( "/app" ) def read_main (): return { "message" : "H...o World from sub API" } app . mount ( "/subapi" , subapi ) Sub-application Then, create your sub-application, and its path operations . This sub-application is just another standard FastAPI application, but this is the one that will be "mounted": Python 3.... - https://man.mtool.work/fastapi/0.115/advanced/sub-applications/
- Global Dependencies 10470
- Global Dependencies Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . For some types of applications you might want to add dependencies to the whole application. Sim
...ath operation decorators , you can add them to the FastAPI application. In that case, they will be applied to all the path operations in the application: Python 3.9+ from fastapi import Depends , FastAPI , Header , HTTPException from typing_extensions impo...n the section about adding dependencies to the path operation decorators still apply, but in this case, to all of the path operations in the app. Dependencies for groups of path operations Later, when reading about how to structure bigger applications ( Bi...e Files ), possibly with multiple files, you will learn how to declare a single dependencies parameter for a group of path operations .... - https://man.mtool.work/fastapi/0.115/tutorial/dependencies/global-dependencies/
- メタデータとドキュメントのURL 9848
- メタデータとドキュメントのURL FastAPI アプリケーションのいくつかのメタデータの設定をカスタマイズできます。 タイトル、説明文、バージョン 以下を設定できます: タイトル : OpenAPIおよび自動APIドキュメントUIでAPIのタイトル/名前として使用される。
...この設定では、自動APIドキュメントは以下の様になります: タグのためのメタデータ さらに、パラメータ openapi_tags を使うと、path operations をグループ分けするための複数のタグに関するメタデータを追加できます。 それぞれのタグ毎にひとつの辞書を含むリストをとります。...それぞれの辞書は以下をもつことができます: name ( 必須 ): path operations および APIRouter の tags パラメーターで使用するのと同じタグ名である str 。 description : タグの簡単な説明文である str 。 M...ags パラメータに渡します。 Python 3.8+ from fastapi import FastAPI tags_metadata = [ { "name" : "users" , "description" : "Operations with users. The **login** logic is also here." , }, { "name" : "items" , "description" : "Manage items. So _fancy_ they ha... - https://man.mtool.work/fastapi/0.115/tutorial/metadata/
- OpenAPI Webhooks 9717
- OpenAPI Webhooks Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . There are cases where you want to tell your API users that your app could call their app (sending
...hooks with FastAPI and OpenAPI With FastAPI , using OpenAPI, you can define the names of these webhooks, the types of HTTP operations that your app can send (e.g. POST , PUT , etc.) and the request bodies that your app would send. This can make it a lot ea...astAPI application, there is a webhooks attribute that you can use to define webhooks , the same way you would define path operations , for example with @app.webhooks.post() . Python 3.8+ from datetime import datetime from fastapi import FastAPI from pydan...eck the docs Now you can start your app and go to http://127.0.0.1:8000/docs . You will see your docs have the normal path operations and now also some webhooks :... - https://man.mtool.work/fastapi/0.115/advanced/openapi-webhooks/
- General - How To - Recipes 9340
- General - How To - Recipes Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . Here are several pointers to other places in the docs, for general or frequent questions
...should, read the docs for Tutorial - Response Model - Return Type . Documentation Tags - OpenAPI To add tags to your path operations , and group them in the docs UI, read the docs for Tutorial - Path Operation Configurations - Tags . Documentation Summary...and Description - OpenAPI To add a summary and description to your path operations , and show them in the docs UI, read the docs for Tutorial - Path Operation Configurations - Summary and Description . Doc... - https://man.mtool.work/fastapi/0.115/how-to/general/
- バックグラウンドタスク 9094
- バックグラウンドタスク レスポンスを返した 後に 実行されるバックグラウンドタスクを定義できます。 これは、リクエスト後に処理を開始する必要があるが、クライアントがレスポンスを受け取る前に処理を終える必要のない操作に役立ちます。 これには、たとえ
...age = "some notification" ) return { "message" : "Notification sent in the background" } バックグラウンドタスクの追加 path operations 関数 内で、 .add_task() メソッドを使用してタスク関数を background tasks オブジェクトに渡します。 Python 3.8+ from fastapi...ド引数 ( message="some notification" )。 依存性注入 BackgroundTasks の使用は依存性注入システムでも機能し、様々な階層 ( path operations 関数 、依存性 (依存可能性)、サブ依存性など) で BackgroundTasks 型のパラメーターを宣言できます。 FastAPI は、それぞれの場合...xt ファイルに書き込まれます。 リクエストにクエリがあった場合、バックグラウンドタスクでログに書き込まれます。 そして、 path operations 関数 で生成された別のバックグラウンドタスクは、 email パスパラメータを使用してメッセージを書き込みます。 技術的な詳細 Back... - https://man.mtool.work/fastapi/0.115/tutorial/background-tasks/
- Response class 8602
- Response class You can declare a parameter in a path operation function or dependency to be of type Response and then you can set data for the response like headers or cookies. You can also use it directly to create an instance of it and re
...turn it from your path operations . You can import it directly from fastapi : from fastapi import Response ::: fastapi.Response... - https://man.mtool.work/fastapi/0.115/reference/response/
- Generate Clients 8471
- Generate Clients 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 OpenAPI specification, you get automatic compatibility with many tools,
...tems (): return [ { "name" : "Plumbus" , "price" : 3 }, { "name" : "Portal Gun" , "price" : 9001 }, ] Notice that the path operations define the models they use for request payload and response payload, using the models Item and ResponseMessage . API Docs...th Tags In many cases your FastAPI app will be bigger, and you will probably use tags to separate different groups of path operations . For example, you could have a section for items and another section for users , and they could be separated by tags: Pyt...nAPI internal operation ID for each path operation . OpenAPI requires that each operation ID is unique across all the path operations , so FastAPI uses the function name , the path , and the HTTP method/operation to generate that operation ID, because that... - https://man.mtool.work/fastapi/0.115/advanced/generate-clients/
- 機能 7980
- 機能 FastAPIの機能 FastAPI は以下の機能をもちます: オープンスタンダード準拠 API作成のための OpenAPI 。これは、 path operations の宣言、パラメータ、ボディリクエスト、セキュリティなどを含んでいます。 JSONスキーマ を使用したデータモデルのドキュ
...できます。 フレームワークによってすべて 自動的に処理 されます。 すべての依存関係はリクエストからのデータを要請できて、 path operationsの制約と自動ドキュメンテーションを拡張できます 。 依存関係で定義された path operation パラメータも 自動検証 が可能です。 複雑...とせず、必要なコードをインポートして使用します。 統合は非常に簡単に使用できるように設計されており(依存関係を用いて)、 path operations で使用されているのと同じ構造と構文を使用して、2行のコードでアプリケーションの「プラグイン」を作成できます。 テスト テストカ... - https://man.mtool.work/fastapi/0.115/features/