Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 25 for Closed (0.2 sec)

  1. docs/en/docs/advanced/custom-response.md

    {!../../../docs_src/custom_response/tutorial008.py!}
    ```
    
    1. This is the generator function. It's a "generator function" because it contains `yield` statements inside.
    2. By using a `with` block, we make sure that the file-like object is closed after the generator function is done. So, after it finishes sending the response.
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 11.7K bytes
    - Viewed (0)
  2. docs/en/docs/advanced/websockets.md

    With that you can connect the WebSocket and then send and receive messages:
    
    <img src="/img/tutorial/websockets/image05.png">
    
    ## Handling disconnections and multiple clients
    
    When a WebSocket connection is closed, the `await websocket.receive_text()` will raise a `WebSocketDisconnect` exception, which you can then catch and handle like in this example.
    
    === "Python 3.9+"
    
        ```Python hl_lines="79-81"
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu May 02 22:37:31 GMT 2024
    - 6.2K bytes
    - Viewed (0)
  3. docs/en/docs/contributing.md

    ## Developing
    
    If you already cloned the <a href="https://github.com/tiangolo/fastapi" class="external-link" target="_blank">fastapi repository</a> and you want to deep dive in the code, here are some guidelines to set up your environment.
    
    ### Virtual environment with `venv`
    
    You can create an isolated virtual local environment in a directory using Python's `venv` module. Let's do this in the cloned repository (where the `requirements.txt` is):
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Jan 11 17:42:43 GMT 2024
    - 14.1K bytes
    - Viewed (0)
  4. docs/em/docs/tutorial/request-files.md

    * `read(size)`: โœ `size` (`int`) ๐Ÿ”ข/๐Ÿฆน ๐Ÿ“.
    * `seek(offset)`: ๐Ÿšถ ๐Ÿ”ข ๐Ÿง˜ `offset` (`int`) ๐Ÿ“.
        * ๐Ÿคถ โ“‚., `await myfile.seek(0)` ๐Ÿ”œ ๐Ÿšถ โ–ถ๏ธ ๐Ÿ“.
        * ๐Ÿ‘‰ โœด๏ธ โš  ๐Ÿšฅ ๐Ÿ‘† ๐Ÿƒ `await myfile.read()` ๐Ÿ• &amp; โคด๏ธ ๐Ÿ’ช โœ ๐ŸŽš ๐Ÿ”„.
    * `close()`: ๐Ÿ” ๐Ÿ“.
    
    ๐ŸŒ ๐Ÿ‘ซ ๐Ÿ‘ฉโ€๐Ÿ”ฌ `async` ๐Ÿ‘ฉโ€๐Ÿ”ฌ, ๐Ÿ‘† ๐Ÿ’ช "โŒ›" ๐Ÿ‘ซ.
    
    ๐Ÿ–ผ, ๐Ÿ”˜ `async` *โžก ๐Ÿ› ๏ธ ๐Ÿ”ข* ๐Ÿ‘† ๐Ÿ’ช ๐Ÿคš ๐ŸŽš โฎ๏ธ:
    
    ```Python
    contents = await myfile.read()
    ```
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Wed Mar 13 19:02:19 GMT 2024
    - 6.6K bytes
    - Viewed (0)
  5. docs/ko/docs/tutorial/request-files.md

    * `read(size)`: ํŒŒ์ผ์˜ ๋ฐ”์ดํŠธ ๋ฐ ๊ธ€์ž์˜ `size`(`int`)๋ฅผ ์ฝ์Šต๋‹ˆ๋‹ค.
    * `seek(offset)`: ํŒŒ์ผ ๋‚ด `offset`(`int`) ์œ„์น˜์˜ ๋ฐ”์ดํŠธ๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.
        * ์˜ˆ) `await myfile.seek(0)` ๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ํŒŒ์ผ์˜ ์‹œ์ž‘๋ถ€๋ถ„์œผ๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.
        * `await myfile.read()` ๋ฅผ ์‚ฌ์šฉํ•œ ํ›„ ๋‚ด์šฉ์„ ๋‹ค์‹œ ์ฝ์„ ๋•Œ ์œ ์šฉํ•ฉ๋‹ˆ๋‹ค.
    * `close()`: ํŒŒ์ผ์„ ๋‹ซ์Šต๋‹ˆ๋‹ค.
    
    ์ƒ๊ธฐ ๋ชจ๋“  ๋ฉ”์†Œ๋“œ๋“ค์ด `async` ๋ฉ”์†Œ๋“œ์ด๊ธฐ ๋•Œ๋ฌธ์— โ€œawaitโ€์„ ์‚ฌ์šฉํ•˜์—ฌ์•ผ ํ•ฉ๋‹ˆ๋‹ค.
    
    ์˜ˆ๋ฅผ๋“ค์–ด, `async` *๊ฒฝ๋กœ ์ž‘๋™ ํ•จ์ˆ˜*์˜ ๋‚ด๋ถ€์—์„œ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๋ฐฉ์‹์œผ๋กœ ๋‚ด์šฉ์„ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:
    
    ```Python
    contents = await myfile.read()
    ```
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Wed Mar 13 19:02:19 GMT 2024
    - 8.1K bytes
    - Viewed (0)
  6. docs/en/docs/alternatives.md

    Routes are declared in a single place, using functions declared in other places (instead of using decorators that can be placed right on top of the function that handles the endpoint). This is closer to how Django does it than to how Flask (and Starlette) does it. It separates in the code things that are relatively tightly coupled.
    
    !!! check "Inspired **FastAPI** to"
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 23.2K bytes
    - Viewed (0)
  7. docs/en/docs/tutorial/sql-databases.md

        ```
    
    !!! info
        We put the creation of the `SessionLocal()` and handling of the requests in a `try` block.
    
        And then we close it in the `finally` block.
    
        This way we make sure the database session is always closed after the request. Even if there was an exception while processing the request.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 29.6K bytes
    - Viewed (0)
  8. docs/en/docs/reference/uploadfile.md

            members:
                - file
                - filename
                - size
                - headers
                - content_type
                - read
                - write
                - seek
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 472 bytes
    - Viewed (0)
  9. docs/en/docs/reference/websockets.md

                - receive_bytes
                - receive_json
                - iter_text
                - iter_bytes
                - iter_json
                - send_text
                - send_bytes
                - send_json
                - close
    
    When a client disconnects, a `WebSocketDisconnect` exception is raised, you can catch it.
    
    You can import it directly form `fastapi`:
    
    ```python
    from fastapi import WebSocketDisconnect
    ```
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 1.6K bytes
    - Viewed (0)
  10. docs/em/docs/tutorial/dependencies/dependencies-with-yield.md

    # ๐Ÿ”— โฎ๏ธ ๐ŸŒพ
    
    FastAPI ๐Ÿ•โ€๐Ÿฆบ ๐Ÿ”— ๐Ÿ‘ˆ <abbr title='sometimes also called "exit", "cleanup", "teardown", "close", "context managers", ...'>โž• ๐Ÿ” โฎ๏ธ ๐Ÿ</abbr>.
    
    ๐Ÿ‘‰, โš™๏ธ `yield` โ†ฉ๏ธ `return`, &amp; โœ โž• ๐Ÿ” โฎ๏ธ.
    
    !!! tip
        โš’ ๐Ÿ’ญ โš™๏ธ `yield` 1๏ธโƒฃ ๐Ÿ‘ ๐Ÿ•ฐ.
    
    !!! note "๐Ÿ“ก โ„น"
        ๐Ÿ™† ๐Ÿ”ข ๐Ÿ‘ˆ โ˜‘ โš™๏ธ โฎ๏ธ:
    
        * <a href="https://docs.python.org/3/library/contextlib.html#contextlib.contextmanager" class="external-link" target="_blank">`@contextlib.contextmanager`</a> โš–๏ธ
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 8.6K bytes
    - Viewed (0)
Back to top