Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 24 for Connections (0.26 sec)

  1. docs_src/websockets/tutorial003_py39.py

    </html>
    """
    
    
    class ConnectionManager:
        def __init__(self):
            self.active_connections: list[WebSocket] = []
    
        async def connect(self, websocket: WebSocket):
            await websocket.accept()
            self.active_connections.append(websocket)
    
        def disconnect(self, websocket: WebSocket):
            self.active_connections.remove(websocket)
    
        async def send_personal_message(self, message: str, websocket: WebSocket):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 2.5K bytes
    - Viewed (0)
  2. docs_src/websockets/tutorial003.py

    </html>
    """
    
    
    class ConnectionManager:
        def __init__(self):
            self.active_connections: List[WebSocket] = []
    
        async def connect(self, websocket: WebSocket):
            await websocket.accept()
            self.active_connections.append(websocket)
    
        def disconnect(self, websocket: WebSocket):
            self.active_connections.remove(websocket)
    
        async def send_personal_message(self, message: str, websocket: WebSocket):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sun Aug 09 13:52:19 GMT 2020
    - 2.5K bytes
    - Viewed (0)
  3. docs/en/docs/tutorial/sql-databases.md

        This is to prevent accidentally sharing the same connection for different things (for different requests).
    
        But in FastAPI, using normal functions (`def`) more than one thread could interact with the database for the same request, so we need to make SQLite know that it should allow that with `connect_args={"check_same_thread": False}`.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 29.6K bytes
    - Viewed (0)
  4. docs/en/docs/how-to/sql-databases-peewee.md

    ```Python hl_lines="18-20"
    {!../../../docs_src/sql_databases_peewee/sql_app/main.py!}
    ```
    
    For the **next request**, as we will reset that context variable again in the `async` dependency `reset_db_state()` and then create a new connection in the `get_db()` dependency, that new request will have its own database state (connection, transactions, etc).
    
    !!! tip
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Jan 16 13:23:25 GMT 2024
    - 23.6K bytes
    - Viewed (0)
  5. docs/en/docs/advanced/websockets.md

    ```
    Client #1596980209979 left the chat
    ```
    
    !!! tip
        The app above is a minimal and simple example to demonstrate how to handle and broadcast messages to several WebSocket connections.
    
        But keep in mind that, as everything is handled in memory, in a single list, it will only work while the process is running, and will only work with a single process.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Jan 11 16:31:18 GMT 2024
    - 6.2K bytes
    - Viewed (0)
  6. docs/en/docs/features.md

    * **Automatic validation** even for *path operation* parameters defined in dependencies.
    * Support for complex user authentication systems, **database connections**, etc.
    * **No compromise** with databases, frontends, etc. But easy integration with all of them.
    
    ### Unlimited "plug-ins"
    
    Or in other way, no need for them, import and use the code you need.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 9.3K bytes
    - Viewed (0)
  7. fastapi/dependencies/utils.py

                required_params=dependant.body_params, received_body=body
            )
            values.update(body_values)
            errors.extend(body_errors)
        if dependant.http_connection_param_name:
            values[dependant.http_connection_param_name] = request
        if dependant.request_param_name and isinstance(request, Request):
            values[dependant.request_param_name] = request
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Apr 02 02:52:56 GMT 2024
    - 29.5K bytes
    - Viewed (0)
  8. docs/en/docs/tutorial/dependencies/dependencies-with-yield.md

    !!! tip
    
        Additionally, a background task is normally an independent set of logic that should be handled separately, with its own resources (e.g. its own database connection).
    
        So, this way you will probably have cleaner code.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Feb 24 23:06:37 GMT 2024
    - 14.1K bytes
    - Viewed (0)
  9. docs/en/docs/advanced/events.md

    This can be very useful for setting up **resources** that you need to use for the whole app, and that are **shared** among requests, 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.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 7.8K bytes
    - Viewed (0)
  10. docs/en/docs/tutorial/dependencies/index.md

    This is very useful when you need to:
    
    * Have shared logic (the same code logic again and again).
    * Share database connections.
    * Enforce security, authentication, role requirements, etc.
    * And many other things...
    
    All these, while minimizing code repetition.
    
    ## First Steps
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 11.6K bytes
    - Viewed (0)
Back to top