Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 36 for connection (0.22 sec)

  1. tests/test_http_connection_injection.py

    app.state.value = 42
    
    
    async def extract_value_from_http_connection(conn: HTTPConnection):
        return conn.app.state.value
    
    
    @app.get("/http")
    async def get_value_by_http(value: int = Depends(extract_value_from_http_connection)):
        return value
    
    
    @app.websocket("/ws")
    async def get_value_by_ws(
        websocket: WebSocket, value: int = Depends(extract_value_from_http_connection)
    ):
        await websocket.accept()
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sun Aug 09 13:56:41 GMT 2020
    - 972 bytes
    - Viewed (0)
  2. tests/test_tutorial/test_websockets/test_tutorial003.py

    
    def test_websocket_handle_disconnection():
        with client.websocket_connect("/ws/1234") as connection, client.websocket_connect(
            "/ws/5678"
        ) as connection_two:
            connection.send_text("Hello from 1234")
            data1 = connection.receive_text()
            assert data1 == "You wrote: Hello from 1234"
            data2 = connection_two.receive_text()
            client1_says = "Client #1234 says: Hello from 1234"
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Jul 29 09:26:07 GMT 2021
    - 872 bytes
    - Viewed (0)
  3. tests/test_tutorial/test_websockets/test_tutorial003_py39.py

    def test_websocket_handle_disconnection(client: TestClient):
        with client.websocket_connect("/ws/1234") as connection, client.websocket_connect(
            "/ws/5678"
        ) as connection_two:
            connection.send_text("Hello from 1234")
            data1 = connection.receive_text()
            assert data1 == "You wrote: Hello from 1234"
            data2 = connection_two.receive_text()
            client1_says = "Client #1234 says: Hello from 1234"
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 1.3K bytes
    - Viewed (0)
  4. docs/en/docs/deployment/https.md

    After this, the client and the server have an **encrypted TCP connection**, this is what TLS provides. And then they can use that connection to start the actual **HTTP communication**.
    
    And that's what **HTTPS** is, it's just plain **HTTP** inside a **secure TLS connection** instead of a pure (unencrypted) TCP connection.
    
    !!! tip
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Jan 11 16:31:18 GMT 2024
    - 12K bytes
    - Viewed (0)
  5. fastapi/dependencies/models.py

            self.security_requirements = security_schemes or []
            self.request_param_name = request_param_name
            self.websocket_param_name = websocket_param_name
            self.http_connection_param_name = http_connection_param_name
            self.response_param_name = response_param_name
            self.background_tasks_param_name = background_tasks_param_name
            self.security_scopes = security_scopes
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 2.4K bytes
    - Viewed (0)
  6. LICENSE

    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Dec 08 07:57:18 GMT 2018
    - 1.1K bytes
    - Viewed (0)
  7. docs_src/websockets/tutorial003.py

        async def broadcast(self, message: str):
            for connection in self.active_connections:
                await connection.send_text(message)
    
    
    manager = ConnectionManager()
    
    
    @app.get("/")
    async def get():
        return HTMLResponse(html)
    
    
    @app.websocket("/ws/{client_id}")
    async def websocket_endpoint(websocket: WebSocket, client_id: int):
        await manager.connect(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)
  8. tests/test_ws_router.py

            assert data == "path/to/file"
            data = websocket.receive_text()
            assert data == "a_query_param"
    
    
    def test_wrong_uri():
        """
        Verify that a websocket connection to a non-existent endpoing returns in a shutdown
        """
        client = TestClient(app)
        with pytest.raises(WebSocketDisconnect) as e:
            with client.websocket_connect("/no-router/"):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sun Jun 11 19:08:14 GMT 2023
    - 7.5K bytes
    - Viewed (0)
  9. 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)
  10. 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)
Back to top