Results of 1 - 10 of about 13 for text (0.002 sec.)
- WebSocket 14340
- WebSocket FastAPI で WebSocket が使用できます。 WebSockets のインストール まず WebSockets のインストールが必要です。 $ pip install websockets ---> 100% WebSocket クライアント 本番環境 本番環境では、React、Vue.js、Angularなどの最新のフレーム
...ad> <title>Chat</title> </head> <body> <h1>WebSocket Chat</h1> <form action="" onsubmit="sendMessage(event)"> <input type="text" id="messageText" autocomplete="off"/> <button>Send</button> </form> <ul id='messages'> </ul> <script> var ws = new WebSoc...var messages = document.getElementById('messages') var message = document.createElement('li') var content = document.createTextNode(event.data) message.appendChild(content) messages.appendChild(message) }; function sendMessage(event) { var input = do...cument.getElementById("messageText") ws.send(input.value) input.value = '' event.preventDefault() } </script> </body> </html> """ @app . get ( "/" ) async de... - https://man.mtool.work/fastapi/0.115/advanced/websockets/
- FastAPI CLI 10398
- 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
...astAPI app for development, you can use the fastapi dev command: $ <font color = "#4E9A06" >fastapi</font> dev <u style = "text-decoration-style:solid" >main.py</u> <span style="background-color:#009485"><font color="#D3D7CF"> FastAPI </font></span>...t color="#D3D7CF"> code </font></span> Importing the FastAPI app object from the module with the following code: <u style="text-decoration-style:solid">from </u><u style="text-decoration-style:solid"><b>main</b></u><u style="text-decoration-style:sol...id"> import </u><u style="text-decoration-style:solid"><b>app</b></u> <span style="background-color:#007166"><font color="#D3D7CF"> app </font></span> Us... - https://man.mtool.work/fastapi/0.115/fastapi-cli/
- WebSockets 9519
- WebSockets When defining WebSockets, you normally declare a parameter of type WebSocket and with it you can read data from the client and send data to it. It is provided directly by Starlette, but you can import it from fastapi : from fasta
...- path_params - cookies - client - state - url_for - client_state - application_state - receive - send - accept - receive_text - receive_bytes - receive_json - iter_text - iter_bytes - iter_json - send_text - send_bytes - send_json - close When a cl... - https://man.mtool.work/fastapi/0.115/reference/websockets/
- カスタムレスポンス - HTML、ストリーム、ファイル、その他のレスポンス 8269
- カスタムレスポンス - HTML、ストリーム、ファイル、その他のレスポンス デフォルトでは、 FastAPI は JSONResponse を使ってレスポンスを返します。 レスポンスを直接返す で見たように、 Response を直接返すことでこの挙動をオーバーライドできます。 しか
...タ response_class は、レスポンスの「メディアタイプ」を定義するために利用されます。 この場合、HTTPヘッダー Content-Type には text/html がセットされます。 そして、OpenAPIにはそのようにドキュメント化されます。 Response を返す レスポンスを直接返す で見たよ...ます。 しかし、一方では response_class に HTMLResponse を渡しているため、 FastAPI はOpenAPIや対話的ドキュメントでHTMLとして text/html でドキュメント化する方法を知っています。 利用可能なレスポンス 以下が利用可能なレスポンスの一部です。 Response を使って...s 。 status_code - int のHTTPステータスコード。 headers - 文字列の dict 。 media_type - メディアタイプを示す str 。例えば "text/html" 。 FastAPI (実際にはStarlette) は自動的にContent-Lengthヘッダーを含みます。また、media_typeに基づいたContent-Typeヘッ... - https://man.mtool.work/fastapi/0.115/advanced/custom-response/
- OpenAPI Webhooks 8129
- OpenAPI Webhooks Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . There are cases where you want to tell your API users that your app could call their app (sending
...cturing your app with multiple files. Notice that with webhooks you are actually not declaring a path (like /items/ ), the text you pass there is just an identifier of the webhook (the name of the event), for example in @app.webhooks.post("new-subscr... - https://man.mtool.work/fastapi/0.115/advanced/openapi-webhooks/
- Repository Management Tasks 8129
- Repository Management Tasks These are the tasks that can be performed to manage the FastAPI repository by team members . Tip This section is useful only to a handful of people, team members with permissions to manage the repository. You can
...g interested in the project, or for having dedicated some time to try to do something. It's difficult to convey emotion in text, use emojis to help. ? In discussions and PRs, in many cases, people bring their frustration and show it without filter, i...that the PR does. Like Add support for teleporting , instead of Teleporting wasn't working, so this PR fixes it . Edit the text of the PR title to start in "imperative", like giving an order. So, instead of Adding support for teleporting use Add supp... - https://man.mtool.work/fastapi/0.115/management-tasks/
- Generate Clients 8076
- 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,
...port json from pathlib import Path file_path = Path ( "./openapi.json" ) openapi_content = json . loads ( file_path . read_text ()) for path_data in openapi_content [ "paths" ] . values (): for operation in path_data . values (): tag = operation [ "t...-" new_operation_id = operation_id [ len ( to_remove ) :] operation [ "operationId" ] = new_operation_id file_path . write_text ( json . dumps ( openapi_content )) import * as fs from 'fs' async function modifyOpenAPIFile ( filePath ) { try { const d... - https://man.mtool.work/fastapi/0.115/advanced/generate-clients/
- Virtual Environments 8076
- 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
...fter you create the virtual environment. $ echo "*" > .venv/.gitignore What that command means echo "*" : will "print" the text * in the terminal (the next part changes that a bit) > : anything printed to the terminal by the command to the left of >...uld not be printed but instead written to the file that goes to the right of > .gitignore : the name of the file where the text should be written And * for Git means "everything". So, it will ignore everything in the .venv directory. That command wil... - https://man.mtool.work/fastapi/0.115/virtual-environments/
- Lifespan Events 7935
- 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
...loaded. Lifespan You can define this startup and shutdown logic using the lifespan parameter of the FastAPI app, and a "context manager" (I'll show you what that is in a second). Let's start with an example and then see it in detail. We create an asy...nc function lifespan() with yield like this: Python 3.8+ from contextlib import asynccontextmanager from fastapi import FastAPI def fake_answer_to_everything_ml_model ( x : float ): return x *...42 ml_models = {} @asynccontextmanager async def lifespan ( app : FastAPI ): # Load the ML model ml_models [ "answer_to_everything" ] = fake_answer_to_eve... - https://man.mtool.work/fastapi/0.115/advanced/events/
- Development - Contributing 7935
- 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
...e the rest unchanged. Do not change anything enclosed in "``" (inline code). In lines starting with /// translate only the text part after | . Leave the rest unchanged. You can translate info boxes like /// warning with for example /// warning | Acht... - https://man.mtool.work/fastapi/0.115/contributing/