Results of 1 - 10 of about 52 for versions (0.004 sec.)
- クエリパラメータと文字列の検証 11410
- クエリパラメータと文字列の検証 FastAPI ではパラメータの追加情報とバリデーションを宣言することができます。 以下のアプリケーションを例にしてみましょう: Python 3.8+ from typing import Union from fastapi import FastAPI app = FastAPI () @app . g
...= { "items" : [{ "item_id" : "Foo" }, { "item_id" : "Bar" }]} if q : results . update ({ "q" : q }) return results ? Other versions and variants Python 3.10+ from fastapi import FastAPI app = FastAPI () @app . get ( "/items/" ) async def read_items ( q :...= { "items" : [{ "item_id" : "Foo" }, { "item_id" : "Bar" }]} if q : results . update ({ "q" : q }) return results ? Other versions and variants Python 3.10+ Python 3.8+ Python 3.10+ - non-Annotated from typing import Annotated from fastapi import FastAP...= { "items" : [{ "item_id" : "Foo" }, { "item_id" : "Bar" }]} if q : results . update ({ "q" : q }) return results ? Other versions and variants Python 3.10+ Python 3.8+ Python 3.10+ - non-Annotated from typing import Annotated from fastapi import FastAP... - https://man.mtool.work/fastapi/0.115/tutorial/query-params-str-validations/
- ボディ - ネストされたモデル 11231
- ボディ - ネストされたモデル FastAPI を使用すると、深くネストされた任意のモデルを定義、検証、文書化、使用することができます(Pydanticのおかげです)。 リストのフィールド 属性をサブタイプとして定義することができます。例えば、Pythonの list は以
...def update_item ( item_id : int , item : Item ): results = { "item_id" : item_id , "item" : item } return results ? Other versions and variants Python 3.10+ from fastapi import FastAPI from pydantic import BaseModel app = FastAPI () class Item ( BaseMod...def update_item ( item_id : int , item : Item ): results = { "item_id" : item_id , "item" : item } return results ? Other versions and variants Python 3.10+ Python 3.9+ from fastapi import FastAPI from pydantic import BaseModel app = FastAPI () class It...def update_item ( item_id : int , item : Item ): results = { "item_id" : item_id , "item" : item } return results ? Other versions and variants Python 3.10+ Python 3.9+ from fastapi import FastAPI from pydantic import BaseModel app = FastAPI () class It... - https://man.mtool.work/fastapi/0.115/tutorial/body-nested-models/
- Virtual Environments 11231
- 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
...re your project's package requirements, you can install them directly. Tip It's a (very) good idea to put the packages and versions your program needs in a file (for example requirements.txt or pyproject.toml ). pip uv $ pip install "fastapi[standard]" -...any different programs that depend on different packages . And some of these projects you work on will depend on different versions of the same package. ? For example, you could create a project called philosophers-stone , this program depends on another...kaban) --> |requires| harry-3 end Tip It's very common in Python packages to try the best to avoid breaking changes in new versions , but it's better to be safe, and install newer versions intentionally and when you can run the tests to check everything... - https://man.mtool.work/fastapi/0.115/virtual-environments/
- レスポンスモデル 10499
- レスポンスモデル path operations のいずれにおいても、 response_model パラメータを使用して、レスポンスのモデルを宣言することができます: @app.get() @app.post() @app.put() @app.delete() など。 Python 3.8+ from typing import Any , List , Union
..._items () -> Any : return [ { "name" : "Portal Gun" , "price" : 42.0 }, { "name" : "Plumbus" , "price" : 32.0 }, ] ? Other versions and variants Python 3.10+ Python 3.9+ from typing import Any from fastapi import FastAPI from pydantic import BaseModel ap...'t do this in production! @app . post ( "/user/" ) async def create_user ( user : UserIn ) -> UserIn : return user ? Other versions and variants Python 3.10+ from fastapi import FastAPI from pydantic import BaseModel , EmailStr app = FastAPI () class Use...'t do this in production! @app . post ( "/user/" ) async def create_user ( user : UserIn ) -> UserIn : return user ? Other versions and variants Python 3.10+ from fastapi import FastAPI from pydantic import BaseModel , EmailStr app = FastAPI () class Use... - https://man.mtool.work/fastapi/0.115/tutorial/response-model/
- リクエストボディ 9424
- リクエストボディ クライアント (ブラウザなど) からAPIにデータを送信する必要があるとき、データを リクエストボディ (request body) として送ります。 リクエスト ボディはクライアントによってAPIへ送られます。 レスポンス ボディはAPIがクライアントに送
...loat , None ] = None app = FastAPI () @app . post ( "/items/" ) async def create_item ( item : Item ): return item ? Other versions and variants Python 3.10+ from fastapi import FastAPI from pydantic import BaseModel class Item ( BaseModel ): name : str...loat , None ] = None app = FastAPI () @app . post ( "/items/" ) async def create_item ( item : Item ): return item ? Other versions and variants Python 3.10+ from fastapi import FastAPI from pydantic import BaseModel class Item ( BaseModel ): name : str...loat , None ] = None app = FastAPI () @app . post ( "/items/" ) async def create_item ( item : Item ): return item ? Other versions and variants Python 3.10+ from fastapi import FastAPI from pydantic import BaseModel class Item ( BaseModel ): name : str... - https://man.mtool.work/fastapi/0.115/tutorial/body/
- パスパラメータと数値の検証 9424
- パスパラメータと数値の検証 クエリパラメータに対して Query でより多くのバリデーションとメタデータを宣言できるのと同じように、パスパラメータに対しても Path で同じ種類のバリデーションとメタデータを宣言することができます。 Pathのインポート まず
...alias = "item-query" ), ): results = { "item_id" : item_id } if q : results . update ({ "q" : q }) return results ? Other versions and variants Python 3.10+ Python 3.9+ Python 3.8+ Python 3.10+ - non-Annotated from typing import Annotated from fastapi i...alias = "item-query" ), ): results = { "item_id" : item_id } if q : results . update ({ "q" : q }) return results ? Other versions and variants Python 3.10+ Python 3.9+ Python 3.8+ Python 3.10+ - non-Annotated from typing import Annotated from fastapi i...ID of the item to get" )): results = { "item_id" : item_id } if q : results . update ({ "q" : q }) return results ? Other versions and variants Python 3.9+ Python 3.8+ from typing import Annotated from fastapi import FastAPI , Path app = FastAPI () @app... - https://man.mtool.work/fastapi/0.115/tutorial/path-params-numeric-validations/
- Request Files 9230
- 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
...ost ( "/uploadfile/" ) async def create_upload_file ( file : UploadFile ): return { "filename" : file . filename } ? Other versions and variants Python 3.8+ Python 3.8+ - non-Annotated from fastapi import FastAPI , File , UploadFile from typing_extension...ost ( "/uploadfile/" ) async def create_upload_file ( file : UploadFile ): return { "filename" : file . filename } ? Other versions and variants Python 3.8+ Python 3.8+ - non-Annotated from fastapi import FastAPI , File , UploadFile from typing_extension...ost ( "/uploadfile/" ) async def create_upload_file ( file : UploadFile ): return { "filename" : file . filename } ? Other versions and variants Python 3.8+ Python 3.8+ - non-Annotated from fastapi import FastAPI , File , UploadFile from typing_extension... - https://man.mtool.work/fastapi/0.115/tutorial/request-files/
- Settings and Environment Variables 8871
- 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
...ttings class Settings ( BaseSettings ): app_name : str = "Awesome API" admin_email : str items_per_user : int = 50 ? Other versions and variants Python 3.9+ Python 3.8+ from pydantic_settings import BaseSettings class Settings ( BaseSettings ): app_name...: settings . app_name , "admin_email" : settings . admin_email , "items_per_user" : settings . items_per_user , } ? Other versions and variants Python 3.8+ Python 3.8+ - non-Annotated from functools import lru_cache from fastapi import Depends , FastAPI...: settings . app_name , "admin_email" : settings . admin_email , "items_per_user" : settings . items_per_user , } ? Other versions and variants Python 3.8+ Python 3.8+ - non-Annotated from functools import lru_cache from fastapi import Depends , FastAPI... - https://man.mtool.work/fastapi/0.115/advanced/settings/
- Path Operationの設定 8692
- Path Operationの設定 path operationデコレータ を設定するためのパラメータがいくつかあります。 注意 これらのパラメータは path operation関数 ではなく、 path operationデコレータ に直接渡されることに注意してください。 レスポンスステータスコード
...sponse_model = Item , status_code = status . HTTP_201_CREATED ) async def create_item ( item : Item ): return item ? Other versions and variants Python 3.10+ Python 3.9+ from fastapi import FastAPI , status from pydantic import BaseModel app = FastAPI ()...: 42 }] @app . get ( "/users/" , tags = [ "users" ]) async def read_users (): return [{ "username" : "johndoe" }] ? Other versions and variants Python 3.10+ Python 3.9+ from fastapi import FastAPI from pydantic import BaseModel app = FastAPI () class It...on, name, description, price, tax and a set of unique tags" , ) async def create_item ( item : Item ): return item ? Other versions and variants Python 3.10+ Python 3.9+ from fastapi import FastAPI from pydantic import BaseModel app = FastAPI () class It... - https://man.mtool.work/fastapi/0.115/tutorial/path-operation-configuration/
- Advanced Dependencies 8513
- 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
..._included : Annotated [ bool , Depends ( checker )]): return { "fixed_content_in_query" : fixed_content_included } ? Other versions and variants Python 3.8+ Python 3.8+ - non-Annotated from fastapi import Depends , FastAPI from typing_extensions import A..._included : Annotated [ bool , Depends ( checker )]): return { "fixed_content_in_query" : fixed_content_included } ? Other versions and variants Python 3.8+ Python 3.8+ - non-Annotated from fastapi import Depends , FastAPI from typing_extensions import A..._included : Annotated [ bool , Depends ( checker )]): return { "fixed_content_in_query" : fixed_content_included } ? Other versions and variants Python 3.8+ Python 3.8+ - non-Annotated from fastapi import Depends , FastAPI from typing_extensions import A... - https://man.mtool.work/fastapi/0.115/advanced/advanced-dependencies/