Results of 1 - 7 of about 7 for mode (0.004 sec.)
- バックグラウンドタスク 12923
- バックグラウンドタスク レスポンスを返した 後に 実行されるバックグラウンドタスクを定義できます。 これは、リクエスト後に処理を開始する必要があるが、クライアントがレスポンスを受け取る前に処理を終える必要のない操作に役立ちます。 これには、たとえ
...BackgroundTasks , FastAPI app = FastAPI () def write_notification ( email : str , message = "" ): with open ( "log.txt" , mode = "w" ) as email_file : content = f "notification for { email } : { message } " email_file . write ( content ) @app . post...BackgroundTasks , FastAPI app = FastAPI () def write_notification ( email : str , message = "" ): with open ( "log.txt" , mode = "w" ) as email_file : content = f "notification for { email } : { message } " email_file . write ( content ) @app . post...BackgroundTasks , FastAPI app = FastAPI () def write_notification ( email : str , message = "" ): with open ( "log.txt" , mode = "w" ) as email_file : content = f "notification for { email } : { message } " email_file . write ( content ) @app . post... - https://man.mtool.work/fastapi/0.115/tutorial/background-tasks/
- FastAPI CLI 10523
- FastAPI CLI Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . FastAPI CLI is a command line program that you can use to serve your FastAPI app, manage your FastAPI p
...00/docs</u></font> <span style="background-color:#007166"><font color="#D3D7CF"> tip </font></span> Running in development mode, for production use: <b>fastapi run</b> Logs: <span style="background-color:#007166"><font color="#D3D7CF"> INFO </font></...uses Uvicorn , a high-performance, production-ready, ASGI server. ? fastapi dev Running fastapi dev initiates development mode. By default, auto-reload is enabled, automatically reloading the server when you make changes to your code. This is resour...our machine to communicate with itself alone ( localhost ). fastapi run Executing fastapi run starts FastAPI in production mode by default. By default, auto-reload is disabled. It also listens on the IP address 0.0.0.0 , which means all the available... - https://man.mtool.work/fastapi/0.115/fastapi-cli/
- Lifespan Events 8760
- 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
...and/or that you need to clean up afterwards. For example, a database connection pool, or loading a shared machine learning model. Use Case Let's start with an example use case and then see how to solve it with this. Let's imagine that you have some m...achine learning models that you want to use to handle requests. ? The same models are shared among requests, so, it's not one model per request..., or one per user or something similar. Let's imagine that loading the model can take quite some time , because it has to read a lot of data from disk . So you don't want to do it for every request.... - https://man.mtool.work/fastapi/0.115/advanced/events/
- Development - Contributing 7961
- Development - Contributing Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . First, you might want to see the basic ways to help FastAPI and get help . Developing If
...ly. That is because inside the requirements.txt file, the local version of FastAPI is marked to be installed in "editable" mode, with the -e option. Format the code There is a script that you can run that will format and clean all your code: $ bash s... - https://man.mtool.work/fastapi/0.115/contributing/
- Release Notes 7961
- 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
...orial/path-params.md . PR #13354 by @valentinDruzhinin . ? Add Japanese translation for docs/ja/docs/tutorial/cookie-param-models.md . PR #13330 by @k94-ishi . ? Add Ukrainian translation for docs/uk/docs/tutorial/body-multiple-params.md . PR #13408...by @valentinDruzhinin . ? Add Japanese translation for docs/ja/docs/tutorial/query-param-models.md . PR #13323 by @k94-ishi . ? Add Ukrainian translation for docs/uk/docs/tutorial/body-nested-models.md . PR #13409 by...al/request-files.md . PR #13395 by @valentinDruzhinin . ? Add Ukrainian translation for docs/uk/docs/tutorial/request-form-models.md . PR #13384 by @valentinDruzhinin . ? Add Ukrainian translation for docs/uk/docs/tutorial/request-forms-and-files.md... - https://man.mtool.work/fastapi/0.115/release-notes/
- カスタムレスポンス - HTML、ストリーム、ファイル、その他のレスポンス 7797
- カスタムレスポンス - HTML、ストリーム、ファイル、その他のレスポンス デフォルトでは、 FastAPI は JSONResponse を使ってレスポンスを返します。 レスポンスを直接返す で見たように、 Response を直接返すことでこの挙動をオーバーライドできます。 しか
...の場合のようにJSONメディアタイプ ( application/json ) ならば、データは path operationデコレータ に宣言したPydantic response_model により自動的に変換 (もしくはフィルタ) されます。 備考 メディアタイプを指定せずにレスポンスクラスを利用すると、FastAPIは何...large-video-file.mp4" app = FastAPI () @app . get ( "/" ) def main (): def iterfile (): # (1) with open ( some_file_path , mode = "rb" ) as file_like : # (2) yield from file_like # (3) return StreamingResponse ( iterfile (), media_type = "video/mp4"... - https://man.mtool.work/fastapi/0.115/advanced/custom-response/
- レスポンスモデル 7633
- レスポンスモデル path operations のいずれにおいても、 response_model パラメータを使用して、レスポンスのモデルを宣言することができます: @app.get() @app.post() @app.put() @app.delete() など。 Python 3.8+ from typing import Any , List , Union
...from fastapi import FastAPI from pydantic import BaseModel app = FastAPI () class Item ( BaseModel ): name : str description : Union [ str , None ] = None price : float tax : Union...[ float , None ] = None tags : List [ str ] = [] @app . post ( "/items/" , response_model = Item ) async def create_item ( item : Item ) -> Any : return item @app . get ( "/items/" , response_model = List [ Item...versions and variants Python 3.10+ Python 3.9+ from typing import Any from fastapi import FastAPI from pydantic import BaseModel app = FastAPI () class Item ( BaseModel ): name : str description : str | None = None price : float tax : float | None =... - https://man.mtool.work/fastapi/0.115/tutorial/response-model/
PREV
1
NEXT