Results of 1 - 10 of about 38 for extensions (0.004 sec.)
- クエリパラメータモデル 12987
- クエリパラメータモデル もし関連する 複数のクエリパラメータ から成るグループがあるなら、それらを宣言するために、 Pydanticモデル を作成できます。 こうすることで、 複数の場所 で そのPydanticモデルを再利用 でき、バリデーションやメタデータを、す
...notated Python 3.8+ - non-Annotated from fastapi import FastAPI , Query from pydantic import BaseModel , Field from typing_extensions import Annotated , Literal app = FastAPI () class FilterParams ( BaseModel ): limit : int = Field ( 100 , gt = 0 , le = 10...ilter_query from typing import List from fastapi import FastAPI , Query from pydantic import BaseModel , Field from typing_extensions import Annotated , Literal app = FastAPI () class FilterParams ( BaseModel ): limit : int = Field ( 100 , gt = 0 , le = 10...the Annotated version if possible. from fastapi import FastAPI , Query from pydantic import BaseModel , Field from typing_extensions import Literal app = FastAPI () class FilterParams ( BaseModel ): limit : int = Field ( 100 , gt = 0 , le = 100 ) offset :... - https://man.mtool.work/fastapi/0.115/tutorial/query-param-models/
- クエリパラメータと文字列の検証 11887
- クエリパラメータと文字列の検証 FastAPI ではパラメータの追加情報とバリデーションを宣言することができます。 以下のアプリケーションを例にしてみましょう: Python 3.8+ from typing import Union from fastapi import FastAPI app = FastAPI () @app . g
...q : results . update ({ "q" : q }) return results from typing import Union from fastapi import FastAPI , Query from typing_extensions import Annotated app = FastAPI () @app . get ( "/items/" ) async def read_items ( q : Annotated [ Union [ str , None ], Qu...q : results . update ({ "q" : q }) return results from typing import Union from fastapi import FastAPI , Query from typing_extensions import Annotated app = FastAPI () @app . get ( "/items/" ) async def read_items ( q : Annotated [ Union [ str , None ], Qu...q : results . update ({ "q" : q }) return results from typing import Union from fastapi import FastAPI , Query from typing_extensions import Annotated app = FastAPI () @app . get ( "/items/" ) async def read_items ( q : Annotated [ Union [ str , None ], Qu... - https://man.mtool.work/fastapi/0.115/tutorial/query-params-str-validations/
- パスパラメータと数値の検証 10236
- パスパラメータと数値の検証 クエリパラメータに対して Query でより多くのバリデーションとメタデータを宣言できるのと同じように、パスパラメータに対しても Path で同じ種類のバリデーションとメタデータを宣言することができます。 Pathのインポート まず
...ults . update ({ "q" : q }) return results from typing import Union from fastapi import FastAPI , Path , Query from typing_extensions import Annotated app = FastAPI () @app . get ( "/items/ {item_id} " ) async def read_items ( item_id : Annotated [ int , P...ults . update ({ "q" : q }) return results from typing import Union from fastapi import FastAPI , Path , Query from typing_extensions import Annotated app = FastAPI () @app . get ( "/items/ {item_id} " ) async def read_items ( item_id : Annotated [ int , P..."item_id" : item_id } if q : results . update ({ "q" : q }) return results from fastapi import FastAPI , Path from typing_extensions import Annotated app = FastAPI () @app . get ( "/items/ {item_id} " ) async def read_items ( q : str , item_id : Annotated... - https://man.mtool.work/fastapi/0.115/tutorial/path-params-numeric-validations/
- Request Files 10063
- Request Files Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . You can define files to be uploaded by the client using File . Info To receive uploaded files, first
...versions and variants Python 3.8+ Python 3.8+ - non-Annotated from fastapi import FastAPI , File , UploadFile from typing_extensions import Annotated app = FastAPI () @app . post ( "/files/" ) async def create_file ( file : Annotated [ bytes , File ()]):...versions and variants Python 3.8+ Python 3.8+ - non-Annotated from fastapi import FastAPI , File , UploadFile from typing_extensions import Annotated app = FastAPI () @app . post ( "/files/" ) async def create_file ( file : Annotated [ bytes , File ()]):...versions and variants Python 3.8+ Python 3.8+ - non-Annotated from fastapi import FastAPI , File , UploadFile from typing_extensions import Annotated app = FastAPI () @app . post ( "/files/" ) async def create_file ( file : Annotated [ bytes , File ()]):... - https://man.mtool.work/fastapi/0.115/tutorial/request-files/
- Advanced Dependencies 9324
- 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
...} ? Other versions and variants Python 3.8+ Python 3.8+ - non-Annotated from fastapi import Depends , FastAPI from typing_extensions import Annotated app = FastAPI () class FixedContentQueryChecker : def __init__ ( self , fixed_content : str ): self . fix...} ? Other versions and variants Python 3.8+ Python 3.8+ - non-Annotated from fastapi import Depends , FastAPI from typing_extensions import Annotated app = FastAPI () class FixedContentQueryChecker : def __init__ ( self , fixed_content : str ): self . fix...} ? Other versions and variants Python 3.8+ Python 3.8+ - non-Annotated from fastapi import Depends , FastAPI from typing_extensions import Annotated app = FastAPI () class FixedContentQueryChecker : def __init__ ( self , fixed_content : str ): self . fix... - https://man.mtool.work/fastapi/0.115/advanced/advanced-dependencies/
- 依存関係としてのクラス 9151
- 依存関係としてのクラス 依存性注入 システムを深く掘り下げる前に、先ほどの例をアップグレードしてみましょう。 前の例の dict 前の例では、依存関係("dependable")から dict を返していました: Python 3.8+ - non-Annotated from typing import Union fr
...Depends ( common_parameters )]): return commons from typing import Union from fastapi import Depends , FastAPI from typing_extensions import Annotated app = FastAPI () async def common_parameters ( q : Union [ str , None ] = None , skip : int = 0 , limit :.... update ({ "items" : items }) return response from typing import Union from fastapi import Depends , FastAPI from typing_extensions import Annotated app = FastAPI () fake_items_db = [{ "item_name" : "Foo" }, { "item_name" : "Bar" }, { "item_name" : "Baz".... update ({ "items" : items }) return response from typing import Union from fastapi import Depends , FastAPI from typing_extensions import Annotated app = FastAPI () fake_items_db = [{ "item_name" : "Foo" }, { "item_name" : "Bar" }, { "item_name" : "Baz"... - https://man.mtool.work/fastapi/0.115/tutorial/dependencies/classes-as-dependenci...
- ヘッダーのパラメータ 8962
- ヘッダーのパラメータ ヘッダーのパラメータは、 Query や Path 、 Cookie のパラメータを定義するのと同じように定義できます。 Header をインポート まず、 Header をインポートします: Python 3.8+ - non-Annotated from typing import Union from fastapi
...] = None ): return { "User-Agent" : user_agent } from typing import Union from fastapi import FastAPI , Header from typing_extensions import Annotated app = FastAPI () @app . get ( "/items/" ) async def read_items ( user_agent : Annotated [ Union [ str , N...] = None ): return { "User-Agent" : user_agent } from typing import Union from fastapi import FastAPI , Header from typing_extensions import Annotated app = FastAPI () @app . get ( "/items/" ) async def read_items ( user_agent : Annotated [ Union [ str , N...): return { "strange_header" : strange_header } from typing import Union from fastapi import FastAPI , Header from typing_extensions import Annotated app = FastAPI () @app . get ( "/items/" ) async def read_items ( strange_header : Annotated [ Union [ str... - https://man.mtool.work/fastapi/0.115/tutorial/header-params/
- path operationデコレータの依存関係 8773
- path operationデコレータの依存関係 場合によっては path operation関数 の中で依存関係の戻り値を本当に必要としないこともあります。 もしくは、依存関係が値を返さない場合もあります。 しかし、それでも実行・解決する必要があります。 このような場合、
...return [{ "item" : "Foo" }, { "item" : "Bar" }] from fastapi import Depends , FastAPI , Header , HTTPException from typing_extensions import Annotated app = FastAPI () async def verify_token ( x_token : Annotated [ str , Header ()]): if x_token != "fake-su...return [{ "item" : "Foo" }, { "item" : "Bar" }] from fastapi import Depends , FastAPI , Header , HTTPException from typing_extensions import Annotated app = FastAPI () async def verify_token ( x_token : Annotated [ str , Header ()]): if x_token != "fake-su...return [{ "item" : "Foo" }, { "item" : "Bar" }] from fastapi import Depends , FastAPI , Header , HTTPException from typing_extensions import Annotated app = FastAPI () async def verify_token ( x_token : Annotated [ str , Header ()]): if x_token != "fake-su... - https://man.mtool.work/fastapi/0.115/tutorial/dependencies/dependencies-in-path-...
- 現在のユーザーの取得 8773
- 現在のユーザーの取得 一つ前の章では、(依存性注入システムに基づいた)セキュリティシステムは、 path operation関数 に str として token を与えていました: Python 3.8+ - non-Annotated from fastapi import Depends , FastAPI from fastapi.security i
...rn { "token" : token } from fastapi import Depends , FastAPI from fastapi.security import OAuth2PasswordBearer from typing_extensions import Annotated app = FastAPI () oauth2_scheme = OAuth2PasswordBearer ( tokenUrl = "token" ) @app . get ( "/items/" ) asy...tapi import Depends , FastAPI from fastapi.security import OAuth2PasswordBearer from pydantic import BaseModel from typing_extensions import Annotated app = FastAPI () oauth2_scheme = OAuth2PasswordBearer ( tokenUrl = "token" ) class User ( BaseModel ): us...tapi import Depends , FastAPI from fastapi.security import OAuth2PasswordBearer from pydantic import BaseModel from typing_extensions import Annotated app = FastAPI () oauth2_scheme = OAuth2PasswordBearer ( tokenUrl = "token" ) class User ( BaseModel ): us... - https://man.mtool.work/fastapi/0.115/tutorial/security/get-current-user/
- Form Models 8600
- Form Models Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . You can use Pydantic models to declare form fields in FastAPI. Info To use forms, first install python-
...ants Python 3.8+ Python 3.8+ - non-Annotated from fastapi import FastAPI , Form from pydantic import BaseModel from typing_extensions import Annotated app = FastAPI () class FormData ( BaseModel ): username : str password : str @app . post ( "/login/" ) as...ants Python 3.8+ Python 3.8+ - non-Annotated from fastapi import FastAPI , Form from pydantic import BaseModel from typing_extensions import Annotated app = FastAPI () class FormData ( BaseModel ): username : str password : str model_config = { "extra" : "... - https://man.mtool.work/fastapi/0.115/tutorial/request-form-models/