Results of 1 - 8 of about 8 for Gun (0.004 sec.)
- Separate OpenAPI Schemas for Input and Output or Not 13302
- Separate OpenAPI Schemas for Input and Output or Not Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . When using Pydantic v2 , the generated OpenAPI is a bit more e
...m ( item : Item ): return item @app . get ( "/items/" ) def read_items () -> list [ Item ]: return [ Item ( name = "Portal Gun" , description = "Device to travel through the multi-rick-verse" , ), Item ( name = "Plumbus" ), ] ? Other versions and va...m ( item : Item ): return item @app . get ( "/items/" ) def read_items () -> list [ Item ]: return [ Item ( name = "Portal Gun" , description = "Device to travel through the multi-rick-verse" , ), Item ( name = "Plumbus" ), ] from typing import List...m ( item : Item ): return item @app . get ( "/items/" ) def read_items () -> List [ Item ]: return [ Item ( name = "Portal Gun" , description = "Device to travel through the multi-rick-verse" , ), Item ( name = "Plumbus" ), ] Model for Input If you... - https://man.mtool.work/fastapi/0.115/how-to/separate-openapi-schemas/
- Generate Clients 9543
- 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,
...response_model = list [ Item ]) async def get_items (): return [ { "name" : "Plumbus" , "price" : 3 }, { "name" : "Portal Gun" , "price" : 9001 }, ] ? Other versions and variants Python 3.8+ from typing import List from fastapi import FastAPI from...response_model = List [ Item ]) async def get_items (): 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...st [ Item ], tags = [ "items" ]) async def get_items (): return [ { "name" : "Plumbus" , "price" : 3 }, { "name" : "Portal Gun" , "price" : 9001 }, ] @app . post ( "/users/" , response_model = ResponseMessage , tags = [ "users" ]) async def create_u... - https://man.mtool.work/fastapi/0.115/advanced/generate-clients/
- Global Dependencies 9452
- 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
...ds ( verify_token ), Depends ( verify_key )]) @app . get ( "/items/" ) async def read_items (): return [{ "item" : "Portal Gun" }, { "item" : "Plumbus" }] @app . get ( "/users/" ) async def read_users (): return [{ "username" : "Rick" }, { "username...ds ( verify_token ), Depends ( verify_key )]) @app . get ( "/items/" ) async def read_items (): return [{ "item" : "Portal Gun" }, { "item" : "Plumbus" }] @app . get ( "/users/" ) async def read_users (): return [{ "username" : "Rick" }, { "username...ds ( verify_token ), Depends ( verify_key )]) @app . get ( "/items/" ) async def read_items (): return [{ "item" : "Portal Gun" }, { "item" : "Plumbus" }] @app . get ( "/users/" ) async def read_users (): return [{ "username" : "Rick" }, { "username... - https://man.mtool.work/fastapi/0.115/tutorial/dependencies/global-dependencies/
- Bigger Applications - Multiple Files 8946
- 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
..._header )], responses = { 404 : { "description" : "Not found" }}, ) fake_items_db = { "plumbus" : { "name" : "Plumbus" }, "gun" : { "name" : "Portal Gun" }} @router . get ( "/" ) async def read_items (): return fake_items_db @router . get ( "/ {item..._header )], responses = { 404 : { "description" : "Not found" }}, ) fake_items_db = { "plumbus" : { "name" : "Plumbus" }, "gun" : { "name" : "Portal Gun" }} @router . get ( "/" ) async def read_items (): return fake_items_db @router . get ( "/ {item..._header )], responses = { 404 : { "description" : "Not found" }}, ) fake_items_db = { "plumbus" : { "name" : "Plumbus" }, "gun" : { "name" : "Portal Gun" }} @router . get ( "/" ) async def read_items (): return fake_items_db @router . get ( "/ {item... - https://man.mtool.work/fastapi/0.115/tutorial/bigger-applications/
- Status Codes 8332
- Status Codes You can import the status module from fastapi : from fastapi import status status is provided directly by Starlette. It contains a group of named constants (variables) with integer status codes. For example: 200: status.HTTP_20
...ms/" , status_code = status . HTTP_418_IM_A_TEAPOT ) def read_items (): return [{ "name" : "Plumbus" }, { "name" : "Portal Gun" }] ::: fastapi.status... - https://man.mtool.work/fastapi/0.115/reference/status/
- レスポンスモデル 7826
- レスポンスモデル path operations のいずれにおいても、 response_model パラメータを使用して、レスポンスのモデルを宣言することができます: @app.get() @app.post() @app.put() @app.delete() など。 Python 3.8+ from typing import Any , List , Union
...item @app . get ( "/items/" , response_model = List [ Item ]) async def read_items () -> Any : return [ { "name" : "Portal Gun" , "price" : 42.0 }, { "name" : "Plumbus" , "price" : 32.0 }, ] ? Other versions and variants Python 3.10+ Python 3.9+ fro...item @app . get ( "/items/" , response_model = list [ Item ]) async def read_items () -> Any : return [ { "name" : "Portal Gun" , "price" : 42.0 }, { "name" : "Plumbus" , "price" : 32.0 }, ] from typing import Any , Union from fastapi import FastAPI...item @app . get ( "/items/" , response_model = list [ Item ]) async def read_items () -> Any : return [ { "name" : "Portal Gun" , "price" : 42.0 }, { "name" : "Plumbus" , "price" : 32.0 }, ] 備考 response_model は「デコレータ」メソッド( get 、 post... - https://man.mtool.work/fastapi/0.115/tutorial/response-model/
- Form Models 7717
- 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-
...ill receive an error response. For example, if the client tries to send the form fields: username : Rick password : Portal Gun extra : Mr. Poopybutthole They will receive an error response telling them that the field extra is not allowed: { "detail"... - https://man.mtool.work/fastapi/0.115/tutorial/request-form-models/
- Release Notes 7103
- Release Notes Latest Changes 0.115.11 Fixes ? Add docs examples and tests (support) for Annotated custom validations, like AfterValidator , revert #13440 . PR #13442 by @tiangolo . New docs: Query Parameters and String Validations - Custom
...Annotated app = FastAPI () data = { "plumbus" : { "description" : "Freshly pickled plumbus" , "owner" : "Morty" }, "portal-gun" : { "description" : "Gun to create portals" , "owner" : "Rick" }, } class OwnerError ( Exception ): pass def get_username... - https://man.mtool.work/fastapi/0.115/release-notes/
PREV
1
NEXT