コンテンツにスキップ
per page, with , order by , clip by
Results of 1 - 7 of about 7 for media (0.009 sec.)
Custom Response Classes - File, HTML, Redirect, Streaming, etc. 12577
Custom Response Classes - File, HTML, Redirect, Streaming, etc. There are several custom response classes you can use to create an instance and return them directly from your path operations . Read more about it in the FastAPI docs for Cust ... can use them to optimize JSON performance. ::: fastapi.responses.UJSONResponse options: members: - charset - status_code - media_type - body - background - raw_headers - render - init_headers - headers - set_cookie - delete_cookie ::: fastapi.response ... s.ORJSONResponse options: members: - charset - status_code - media_type - body - background - raw_headers - render - init_headers - headers - set_cookie - delete_cookie Starlette Responses ... ::: fastapi.responses.FileResponse options: members: - chunk_size - charset - status_code - media_type - body - background - raw_headers - render - init_headers - headers - set_cookie - delete_cookie ::: fastapi.response ...
https://man.mtool.work/fastapi/0.115/reference/responses/
Additional Responses in OpenAPI 11105
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 ... ht not need this. You can declare additional responses, with additional status codes, media types, descriptions, etc. Those additional responses will be included in the OpenAPI schema, so they will also appear in t ... e. The correct place is: In the key content , that has as value another JSON object ( dict ) that contains: A key with the media type, e.g. application/json , that contains as value another JSON object, that contains: A key schema , that has as the va ... itle" : "Detail" , "type" : "array" , "items" : { "$ref" : "#/components/schemas/ValidationError" } } } } } } } Additional media types for the main response You can use this same responses parameter to add different media types for the same main respo ...
https://man.mtool.work/fastapi/0.115/advanced/additional-responses/
カスタムレスポンス - HTML、ストリーム、ファイル、その他のレスポンス 8669
カスタムレスポンス - HTML、ストリーム、ファイル、その他のレスポンス デフォルトでは、 FastAPI は JSONResponse を使ってレスポンスを返します。 レスポンスを直接返す で見たように、 Response を直接返すことでこの挙動をオーバーライドできます。 しか ... のパラメータを受け付けます。 content - str か bytes 。 status_code - int のHTTPステータスコード。 headers - 文字列の dict 。 media_type - メディアタイプを示す str 。例えば "text/html" 。 FastAPI (実際にはStarlette) は自動的にContent-Lengthヘッダーを含み ... ます。また、media_typeに基づいたContent-Typeヘッダーを含み、テキストタイプのためにcharsetを追加します。 Python 3.8+ from fastapi import Fast ... ply shampoo here. </Header> <Body> You'll have to use soap here. </Body> </shampoo> """ return Response ( content = data , media_type = "application/xml" ) HTMLResponse 上で読んだように、テキストやバイトを受け取り、HTMLレスポンスを返します。 PlainText ...
https://man.mtool.work/fastapi/0.115/advanced/custom-response/
レスポンスを直接返す 7888
レスポンスを直接返す FastAPI の path operation では、通常は任意のデータを返すことができます: 例えば、 dict 、 list 、Pydanticモデル、データベースモデルなどです。 デフォルトでは、 FastAPI は JSON互換エンコーダ で説明されている jsonable_encod ... ply shampoo here. </Header> <Body> You'll have to use soap here. </Body> </shampoo> """ return Response ( content = data , media_type = "application/xml" ) 備考 Response を直接返す場合、バリデーションや、変換 (シリアライズ) や、自動ドキュメントは行われ ...
https://man.mtool.work/fastapi/0.115/advanced/response-directly/
Request Files 7888
Request Files Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . You can define files to be uploaded by the client using File . Info To receive uploaded files, first ... with the original file name that was uploaded (e.g. myimage.jpg ). content_type : A str with the content type (MIME type / media type) (e.g. image/jpeg ). file : A SpooledTemporaryFile (a file-like object). This is the actual Python file object that y ... e to read that data from the right place instead of JSON. Technical Details Data from forms is normally encoded using the "media type" application/x-www-form-urlencoded when it doesn't include files. But when the form includes files, it is encoded as ...
https://man.mtool.work/fastapi/0.115/tutorial/request-files/
フォームデータ 7888
フォームデータ JSONの代わりにフィールドを受け取る場合は、 Form を使用します。 情報 フォームを使うためには、まず python-multipart をインストールします。 たとえば、 pip install python-multipart のように。 Form のインポート fastapi から Form を ... そのデータを適切な場所から読み込むようにします。 技術詳細 フォームからのデータは通常、 application/x-www-form-urlencoded の「media type」を使用してエンコードされます。 しかし、フォームがファイルを含む場合は、 multipart/form-data としてエンコードされます ...
https://man.mtool.work/fastapi/0.115/tutorial/request-forms/
Release Notes 7543
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 ... ic to >=1.7.4. This fixes an issue when trying to use an old version of Pydantic. PR #9567 by @Kludex . Refactors ♻ Remove media_type from ORJSONResponse as it's inherited from the parent class. PR #5805 by @Kludex . ♻ Instantiate HTTPException only w ...
https://man.mtool.work/fastapi/0.115/release-notes/
PREV 1 NEXT