コンテンツにスキップ
per page, with , order by , clip by
Results of 1 - 10 of about 12 for bytes (0.003 sec.)
HTTP Basic Auth 13035
HTTP Basic Auth Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . For the simplest cases, you can use HTTP Basic Auth. In HTTP Basic Auth, the application expects a ... or this, use the Python standard module secrets to check the username and password. secrets.compare_digest() needs to take bytes or a str that only contains ASCII characters (the ones in English), this means it wouldn't work with characters like á , a ... s in Sebastián . To handle that, we first convert the username and password to bytes encoding them with UTF-8. Then we can use secrets.compare_digest() to ensure that credentials.username is "stanleyjobson" ... () def get_current_username ( credentials : Annotated [ HTTPBasicCredentials , Depends ( security )], ): current_username_bytes = credentials . username . encode ( "utf8" ) correct_username_bytes = b "stanleyjobson" is_correct_username = secrets . co ...
https://man.mtool.work/fastapi/0.115/advanced/security/http-basic-auth/
Request Files 12186
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 ... i import FastAPI , File , UploadFile app = FastAPI () @app . post ( "/files/" ) async def create_file ( file : Annotated [ bytes , File ()]): return { "file_size" : len ( file )} @app . post ( "/uploadfile/" ) async def create_upload_file ( file : Upl ... m typing_extensions import Annotated app = FastAPI () @app . post ( "/files/" ) async def create_file ( file : Annotated [ bytes , File ()]): return { "file_size" : len ( file )} @app . post ( "/uploadfile/" ) async def create_upload_file ( file : Upl ... from fastapi import FastAPI , File , UploadFile app = FastAPI () @app . post ( "/files/" ) async def create_file ( file : bytes = File ()): return { "file_size" : len ( file )} @app . post ( "/uploadfile/" ) async def create_upload_file ( file : Uplo ...
https://man.mtool.work/fastapi/0.115/tutorial/request-files/
リクエストフォームとファイル 9356
リクエストフォームとファイル File と Form を同時に使うことでファイルとフォームフィールドを定義することができます。 情報 アップロードされたファイルやフォームデータを受信するには、まず python-multipart をインストールします。 例えば、 pip inst ... astapi import FastAPI , File , Form , UploadFile app = FastAPI () @app . post ( "/files/" ) async def create_file ( file : bytes = File (), fileb : UploadFile = File (), token : str = Form () ): return { "file_size" : len ( file ), "token" : token , " ... t FastAPI , File , Form , UploadFile app = FastAPI () @app . post ( "/files/" ) async def create_file ( file : Annotated [ bytes , File ()], fileb : Annotated [ UploadFile , File ()], token : Annotated [ str , Form ()], ): return { "file_size" : len ( ... m typing_extensions import Annotated app = FastAPI () @app . post ( "/files/" ) async def create_file ( file : Annotated [ bytes , File ()], fileb : Annotated [ UploadFile , File ()], token : Annotated [ str , Form ()], ): return { "file_size" : len ( ...
https://man.mtool.work/fastapi/0.115/tutorial/request-forms-and-files/
WebSockets 8896
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 ... - 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 client disconnects ...
https://man.mtool.work/fastapi/0.115/reference/websockets/
Pythonの型の紹介 8189
Pythonの型の紹介 Python 3.6以降 では「型ヒント」オプションがサポートされています。 これらの "型ヒント" は変数の 型 を宣言することができる新しい構文です。(Python 3.6以降) 変数に型を宣言することでエディターやツールがより良いサポートを提供す ... す。 単純な型 str だけでなく、Pythonの標準的な型すべてを宣言することができます。 例えば、以下を使用可能です: int float bool bytes Python 3.8+ def get_items ( item_a : str , item_b : int , item_c : float , item_d : bool , item_e : bytes ): return item_a ... 様です: Python 3.8+ from typing import Set , Tuple def process_items ( items_t : Tuple [ int , int , str ], items_s : Set [ bytes ]): return items_t , items_s ? Other versions and variants Python 3.9+ def process_items ( items_t : tuple [ int , int , s ... tr ], items_s : set [ bytes ]): return items_t , items_s つまり: 変数 items_t は int 、 int 、 str の3つの項目を持つ tuple です 変数 items_s はそれぞれ ...
https://man.mtool.work/fastapi/0.115/python-types/
Custom Request and APIRoute class 7906
Custom Request and APIRoute class Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . In some cases, you may want to override the logic used by the Request and APIRout ... astAPI , Request , Response from fastapi.routing import APIRoute class GzipRequest ( Request ): async def body ( self ) -> bytes : if not hasattr ( self , "_body" ): body = await super () . body () if "gzip" in self . headers . getlist ( "Content-Enco ... astAPI , Request , Response from fastapi.routing import APIRoute class GzipRequest ( Request ): async def body ( self ) -> bytes : if not hasattr ( self , "_body" ): body = await super () . body () if "gzip" in self . headers . getlist ( "Content-Enco ...
https://man.mtool.work/fastapi/0.115/how-to/custom-request-and-route/
External Links and Articles 7835
External Links and Articles FastAPI has a great community constantly growing. There are many posts, articles, tools, and projects, related to FastAPI . Here's an incomplete list of some of them. Tip If you have an article, project, tool, or ... al Python . Do you dare to press "."? - Episode 247 - Dan #6: SQLModel - use the same models for SQL and FastAPI by Python Bytes FM . Build The Next Generation Of Python Web Applications With FastAPI - Episode 259 - interview to Sebastían Ramírez (tia ... ngolo) by Podcast. __init__ . FastAPI on PythonBytes by Python Bytes FM . Talks English PyCon AU 2023: Testing asynchronous applications with FastAPI and pytest by Jeny Sadadi ...
https://man.mtool.work/fastapi/0.115/external-links/
追加データ型 7835
追加データ型 今までは、以下のような一般的なデータ型を使用してきました: int float str bool しかし、より複雑なデータ型を使用することもできます。 そして、今まで見てきたのと同じ機能を持つことになります: 素晴らしいエディタのサポート 受信したリク ... ist に変換されます。 生成されたスキーマは set の値が一意であることを指定します(JSON Schemaの uniqueItems を使用します)。 bytes : Pythonの標準的な bytes です。 リクエストとレスポンスでは str として扱われます。 生成されたスキーマは str で binary の「フ ...
https://man.mtool.work/fastapi/0.115/tutorial/extra-data-types/
カスタムレスポンス - HTML、ストリーム、ファイル、その他のレスポンス 7800
カスタムレスポンス - HTML、ストリーム、ファイル、その他のレスポンス デフォルトでは、 FastAPI は JSONResponse を使ってレスポンスを返します。 レスポンスを直接返す で見たように、 Response を直接返すことでこの挙動をオーバーライドできます。 しか ... で、他の全てのレスポンスはこれを継承しています。 直接返すことができます。 以下のパラメータを受け付けます。 content - str か bytes 。 status_code - int のHTTPステータスコード。 headers - 文字列の dict 。 media_type - メディアタイプを示す str 。例えば "t ... mport StreamingResponse app = FastAPI () async def fake_video_streamer (): for i in range ( 10 ): yield b "some fake video bytes" @app . get ( "/" ) async def main (): return StreamingResponse ( fake_video_streamer ()) StreamingResponse をファイルライ ...
https://man.mtool.work/fastapi/0.115/advanced/custom-response/
Advanced Middleware 7800
Advanced Middleware Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . In the main tutorial you read how to add Custom Middleware to your application. And then you al ... nt" The following arguments are supported: minimum_size - Do not GZip responses that are smaller than this minimum size in bytes. Defaults to 500 . compresslevel - Used during GZip compression. It is an integer ranging from 1 to 9. Defaults to 9 . Low ...
https://man.mtool.work/fastapi/0.115/advanced/middleware/
PREV 1 2 NEXT