Results of 1 - 5 of about 5 for Fighters (0.001 sec.)
- 追加のステータスコード 11637
- 追加のステータスコード デフォルトでは、 FastAPI は JSONResponse を使ってレスポンスを返します。その JSONResponse の中には、 path operation が返した内容が入ります。 それは、デフォルトのステータスコードか、 path operation でセットしたものを利用
...i import Body , FastAPI , status from fastapi.responses import JSONResponse app = FastAPI () items = { "foo" : { "name" : "Fighters" , "size" : 6 }, "bar" : { "name" : "Tenders" , "size" : 3 }} @app . put ( "/items/ {item_id} " ) async def upsert_item (...i import Body , FastAPI , status from fastapi.responses import JSONResponse app = FastAPI () items = { "foo" : { "name" : "Fighters" , "size" : 6 }, "bar" : { "name" : "Tenders" , "size" : 3 }} @app . put ( "/items/ {item_id} " ) async def upsert_item (...i import Body , FastAPI , status from fastapi.responses import JSONResponse app = FastAPI () items = { "foo" : { "name" : "Fighters" , "size" : 6 }, "bar" : { "name" : "Tenders" , "size" : 3 }} @app . put ( "/items/ {item_id} " ) async def upsert_item (... - https://man.mtool.work/fastapi/0.115/advanced/additional-status-codes/
- Testing Events: startup - shutdown 11086
- Testing Events: startup - shutdown Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . When you need your event handlers ( startup and shutdown ) to run in your tests,
...Client app = FastAPI () items = {} @app . on_event ( "startup" ) async def startup_event (): items [ "foo" ] = { "name" : "Fighters" } items [ "bar" ] = { "name" : "Tenders" } @app . get ( "/items/ {item_id} " ) async def read_items ( item_id : str ): re...t : response = client . get ( "/items/foo" ) assert response . status_code == 200 assert response . json () == { "name" : "Fighters" }... - https://man.mtool.work/fastapi/0.115/advanced/testing-events/
- レスポンスモデル 8291
- レスポンスモデル path operations のいずれにおいても、 response_model パラメータを使用して、レスポンスのモデルを宣言することができます: @app.get() @app.post() @app.put() @app.delete() など。 Python 3.8+ from typing import Any , List , Union
...: float = 10.5 items = { "foo" : { "name" : "Foo" , "price" : 50.2 }, "bar" : { "name" : "Bar" , "description" : "The Bar fighters" , "price" : 62 , "tax" : 20.2 }, "baz" : { "name" : "Baz" , "description" : "There goes my baz" , "price" : 50.2 , "tax"...: float = 10.5 items = { "foo" : { "name" : "Foo" , "price" : 50.2 }, "bar" : { "name" : "Bar" , "description" : "The Bar fighters" , "price" : 62 , "tax" : 20.2 }, "baz" : { "name" : "Baz" , "description" : "There goes my baz" , "price" : 50.2 , "tax"...: float = 10.5 items = { "foo" : { "name" : "Foo" , "price" : 50.2 }, "bar" : { "name" : "Bar" , "description" : "The Bar fighters" , "price" : 62 , "tax" : 20.2 }, "baz" : { "name" : "Baz" , "description" : "There goes my baz" , "price" : 50.2 , "tax"... - https://man.mtool.work/fastapi/0.115/tutorial/response-model/
- Response - Change Status Code 7923
- Response - Change Status Code Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . You probably read before that you can set a default Response Status Code . But in som
...object. Python 3.8+ from fastapi import FastAPI , Response , status app = FastAPI () tasks = { "foo" : "Listen to the Bar Fighters" } @app . put ( "/get-or-create-task/ {task_id} " , status_code = 200 ) def get_or_create_task ( task_id : str , response... - https://man.mtool.work/fastapi/0.115/advanced/response-change-status-code/
- Lifespan Events 6986
- 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
...astAPI app = FastAPI () items = {} @app . on_event ( "startup" ) async def startup_event (): items [ "foo" ] = { "name" : "Fighters" } items [ "bar" ] = { "name" : "Tenders" } @app . get ( "/items/ {item_id} " ) async def read_items ( item_id : str ): re... - https://man.mtool.work/fastapi/0.115/advanced/events/
PREV
1
NEXT