コンテンツにスキップ
per page, with , order by , clip by
Results of 1 - 10 of about 13 for Note (0.004 sec.)
yieldを持つ依存関係 11806
yieldを持つ依存関係 FastAPIは、いくつかの 終了後の追加のステップ を行う依存関係をサポートしています。 これを行うには、 return の代わりに yield を使い、その後に追加のステップを書きます。 豆知識 yield は必ず一度だけ使用するようにしてください。 ... on handler participant dep as Dep with yield participant operation as Path Operation participant tasks as Background tasks Note over client,tasks: Can raise exception for dependency, handled after response is sent Note over client,operation: Can rais ... e HTTPException and can change the response client ->> dep: Start request Note over dep: Run code up to yield opt raise dep -->> handler: Raise HTTPException handler -->> client: HTTP error response de ... client: HTTP error response operation -->> dep: Raise other exception end operation ->> client: Return response to client Note over client,operation: Response is already sent, can't change it anymore opt Tasks operation -->> tasks: Send background t ...
https://man.mtool.work/fastapi/0.115/tutorial/dependencies/dependencies-with-yie...
Form Models 11155
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- ... Make sure you create a virtual environment , activate it, and then install it, for example: $ pip install python-multipart Note This is supported since FastAPI version 0.113.0 . ? Pydantic Models for Forms You just need to declare a Pydantic model wi ... on), you might want to restrict the form fields to only those declared in the Pydantic model. And forbid any extra fields. Note This is supported since FastAPI version 0.114.0 . ? You can use Pydantic's model configuration to forbid any extra fields: ...
https://man.mtool.work/fastapi/0.115/tutorial/request-form-models/
Async Tests 10504
Async Tests Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . You have already seen how to test your FastAPI applications using the provided TestClient . Up to now, ... se = await ac . get ( "/" ) assert response . status_code == 200 assert response . json () == { "message" : "Tomato" } Tip Note that the test function is now async def instead of just def as before when using the TestClient . Then we can create an As ... This is the equivalent to: response = client . get ( '/' ) ...that we used to make our requests with the TestClient . Tip Note that we're using async/await with the new AsyncClient - the request is asynchronous. Warning If your application relies on ...
https://man.mtool.work/fastapi/0.115/advanced/async-tests/
Release Notes 10170
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 ... udes in docs/en/docs/tutorial/header-param-models.md . PR #12814 by @zhaohan-dong . ? Update contributing.md docs, include note to not translate this page. PR #12841 by @tiangolo . ? Update includes in docs/en/docs/tutorial/request-forms.md . PR #126 ... dd External Link: Techniques and applications of SQLAlchemy global filters in FastAPI. PR #12109 by @TheShubhendra . ? Add note about time.perf_counter() in middlewares. PR #12095 by @tiangolo . ? Tweak middleware code sample time.time() to time.perf ... ponse directly. PR #12067 by @tiangolo . ? Fix minor typos and issues in the documentation. PR #12063 by @svlandeg . ? Add note in Docker docs about ensuring graceful shutdowns and lifespan events with CMD exec form. PR #11960 by @GPla . Translations ...
https://man.mtool.work/fastapi/0.115/release-notes/
Testing WebSockets 9853
Testing WebSockets Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . You can use the same TestClient to test WebSockets. For this, you use the TestClient in a with s ... websocket_connect ( "/ws" ) as websocket : data = websocket . receive_json () assert data == { "msg" : "Hello WebSocket" } Note For more details, check Starlette's documentation for testing WebSockets . ...
https://man.mtool.work/fastapi/0.115/advanced/testing-websockets/
Additional Responses in OpenAPI 8868
Additional Responses in OpenAPI Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . Warning This is a rather advanced topic. If you are starting with FastAPI , you mig ... " , "value" : "there goes my hero" } return JSONResponse ( status_code = 404 , content = { "message" : "Item not found" }) Note Keep in mind that you have to return the JSONResponse directly. Info The model key is not part of OpenAPI. FastAPI will ta ... rn FileResponse ( "image.png" , media_type = "image/png" ) else : return { "id" : "foo" , "value" : "there goes my hero" } Note Notice that you have to return the image using a FileResponse directly. Info Unless you specify a different media type exp ... s = { 404 : { "description" : "Item not found" }, 302 : { "description" : "The item was moved" }, 403 : { "description" : "Not enough privileges" }, } app = FastAPI () @app . get ( "/items/ {item_id} " , response_model = Item , responses = { ** respo ...
https://man.mtool.work/fastapi/0.115/advanced/additional-responses/
Using the Request Directly 8868
Using the Request Directly Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . Up to now, you have been declaring the parts of the request that you need with their typ ... operation function parameter with the type being the Request FastAPI will know to pass the Request in that parameter. Tip Note that in this case, we are declaring a path parameter beside the request parameter. So, the path parameter will be extracte ...
https://man.mtool.work/fastapi/0.115/advanced/using-request-directly/
Templates 8217
Templates Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . You can use any template engine you want with FastAPI . A common choice is Jinja2, the same one used by F ... est , id : str ): return templates . TemplateResponse ( request = request , name = "item.html" , context = { "id" : id } ) Note Before FastAPI 0.108.0, Starlette 0.29.0, the name was the first parameter. Also, before that, in previous versions, the r ...
https://man.mtool.work/fastapi/0.115/advanced/templates/
FastAPIを応援 - ヘルプの入手 7548
FastAPIを応援 - ヘルプの入手 FastAPI は気に入りましたか? FastAPIやユーザーや開発者を応援したいですか? もしくは、 FastAPI についてヘルプが必要ですか? とても簡単に応援できます (ただ1、2回クリックするだけのものもあります)。 また、ヘルプを入手す ... ことができます。 issuesを立てる GitHubレポジトリで 新たなissueを立てられます 。例えば: 質問、または、問題の報告 新機能の提案 Note : issueを立てた人は、他の人の手助けもお願いします。? プルリクエストをする 以下の様な プルリクエストを作成 できます: ドキュ ...
https://man.mtool.work/fastapi/0.115/help-fastapi/
Bigger Applications - Multiple Files 7548
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 ... that will be added to all the path operations in the router and will be executed/solved for each request made to them. Tip Note that, much like dependencies in path operation decorators , no value will be passed to your path operation function . The ... will work correctly, together with all the other path operations added with app.include_router() . Very Technical Details Note : this is a very technical detail that you probably can just skip . The APIRouter s are not "mounted", they are not isolat ...
https://man.mtool.work/fastapi/0.115/tutorial/bigger-applications/
PREV 1 2 NEXT