Search Options

Results per page
Sort
Preferred Languages
Advance

Results 51 - 60 of 80 for and (0.67 sec)

  1. docs_src/websockets/tutorial002_an.py

    
    async def get_cookie_or_token(
        websocket: WebSocket,
        session: Annotated[Union[str, None], Cookie()] = None,
        token: Annotated[Union[str, None], Query()] = None,
    ):
        if session is None and token is None:
            raise WebSocketException(code=status.WS_1008_POLICY_VIOLATION)
        return session or token
    
    
    @app.websocket("/items/{item_id}/ws")
    async def websocket_endpoint(
        *,
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 2.8K bytes
    - Viewed (0)
  2. docs_src/websockets/tutorial002_an_py39.py

    
    async def get_cookie_or_token(
        websocket: WebSocket,
        session: Annotated[Union[str, None], Cookie()] = None,
        token: Annotated[Union[str, None], Query()] = None,
    ):
        if session is None and token is None:
            raise WebSocketException(code=status.WS_1008_POLICY_VIOLATION)
        return session or token
    
    
    @app.websocket("/items/{item_id}/ws")
    async def websocket_endpoint(
        *,
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 2.8K bytes
    - Viewed (0)
  3. .github/actions/notify-translations/app/main.py

        # Avoid race conditions with multiple labels
        sleep_time = random.random() * 10  # random number between 0 and 10 seconds
        logging.info(
            f"Sleeping for {sleep_time} seconds to avoid "
            "race conditions and multiple comments"
        )
        time.sleep(sleep_time)
    
        # Get PR
        logging.debug(f"Processing PR: #{github_event.pull_request.number}")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Wed Sep 27 23:01:46 GMT 2023
    - 12.4K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_schema_extra_example/test_tutorial004_an.py

    from dirty_equals import IsDict
    from fastapi.testclient import TestClient
    
    from docs_src.schema_extra_example.tutorial004_an import app
    
    client = TestClient(app)
    
    
    # Test required and embedded body parameters with no bodies sent
    def test_post_body_example():
        response = client.put(
            "/items/5",
            json={
                "name": "Foo",
                "description": "A very nice Item",
                "price": 35.4,
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 6.9K bytes
    - Viewed (0)
  5. tests/test_tutorial/test_schema_extra_example/test_tutorial004_an_py39.py

    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.schema_extra_example.tutorial004_an_py39 import app
    
        client = TestClient(app)
        return client
    
    
    # Test required and embedded body parameters with no bodies sent
    @needs_py39
    def test_post_body_example(client: TestClient):
        response = client.put(
            "/items/5",
            json={
                "name": "Foo",
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 7.1K bytes
    - Viewed (0)
  6. bin/diff_yaml.py

    # distributed under the License is distributed on an "AS IS" BASIS,
    # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    # See the License for the specific language governing permissions and
    # limitations under the License.
    #
    # Compare 2 multi document kubernetes yaml files
    # It ensures that order does not matter
    #
    from __future__ import print_function
    import argparse
    import datadiff
    import sys
    Python
    - Registered: Wed May 01 22:53:12 GMT 2024
    - Last Modified: Wed Mar 03 16:14:57 GMT 2021
    - 4.5K bytes
    - Viewed (0)
  7. docs_src/response_headers/tutorial002.py

    from fastapi import FastAPI, Response
    
    app = FastAPI()
    
    
    @app.get("/headers-and-object/")
    def get_headers(response: Response):
        response.headers["X-Cat-Dog"] = "alone in the world"
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 222 bytes
    - Viewed (0)
  8. docs_src/openapi_callbacks/tutorial001.py

    def create_invoice(invoice: Invoice, callback_url: Union[HttpUrl, None] = None):
        """
        Create an invoice.
    
        This will (let's imagine) let the API user (some external developer) create an
        invoice.
    
        And this path operation will:
    
        * Send the invoice to the client.
        * Collect the money from the client.
        * Send a notification back to the API user (the external developer), as a callback.
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 1.3K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_configure_swagger_ui/test_tutorial001.py

    
    def test_swagger_ui():
        response = client.get("/docs")
        assert response.status_code == 200, response.text
        assert (
            '"syntaxHighlight": false' in response.text
        ), "syntaxHighlight should be included and converted to JSON"
        assert (
            '"dom_id": "#swagger-ui"' in response.text
        ), "default configs should be preserved"
        assert "presets: [" in response.text, "default configs should be preserved"
        assert (
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Aug 19 19:54:04 GMT 2023
    - 1.4K bytes
    - Viewed (0)
  10. tests/test_dependency_contextvars.py

    
    client = TestClient(app)
    
    
    def test_dependency_contextvars():
        """
        Check that custom middlewares don't affect the contextvar context for dependencies.
    
        The code before yield and the code after yield should be run in the same contextvar
        context, so that request_state_context_var.reset(contextvar_token).
    
        If they are run in a different context, that raises an error.
        """
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Feb 17 12:40:12 GMT 2022
    - 1.5K bytes
    - Viewed (0)
Back to top