Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 50 for Hatch (0.17 sec)

  1. docs_src/query_params_str_validations/tutorial008.py

    
    @app.get("/items/")
    async def read_items(
        q: Union[str, None] = Query(
            default=None,
            title="Query string",
            description="Query string for the items to search in the database that have a good match",
            min_length=3,
        ),
    ):
        results = {"items": [{"item_id": "Foo"}, {"item_id": "Bar"}]}
        if q:
            results.update({"q": q})
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Oct 24 20:26:06 GMT 2023
    - 466 bytes
    - Viewed (0)
  2. docs_src/query_params_str_validations/tutorial010_an.py

        q: Annotated[
            Union[str, None],
            Query(
                alias="item-query",
                title="Query string",
                description="Query string for the items to search in the database that have a good match",
                min_length=3,
                max_length=50,
                pattern="^fixedquery$",
                deprecated=True,
            ),
        ] = None,
    ):
        results = {"items": [{"item_id": "Foo"}, {"item_id": "Bar"}]}
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Oct 24 20:26:06 GMT 2023
    - 664 bytes
    - Viewed (0)
  3. tests/test_operations_signatures.py

    import inspect
    
    from fastapi import APIRouter, FastAPI
    
    method_names = ["get", "put", "post", "delete", "options", "head", "patch", "trace"]
    
    
    def test_signatures_consistency():
        base_sig = inspect.signature(APIRouter.get)
        for method_name in method_names:
            router_method = getattr(APIRouter, method_name)
            app_method = getattr(FastAPI, method_name)
            router_sig = inspect.signature(router_method)
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Mon May 27 12:08:13 GMT 2019
    - 934 bytes
    - Viewed (0)
  4. docs_src/body_updates/tutorial002.py

        "baz": {"name": "Baz", "description": None, "price": 50.2, "tax": 10.5, "tags": []},
    }
    
    
    @app.get("/items/{item_id}", response_model=Item)
    async def read_item(item_id: str):
        return items[item_id]
    
    
    @app.patch("/items/{item_id}", response_model=Item)
    async def update_item(item_id: str, item: Item):
        stored_item_data = items[item_id]
        stored_item_model = Item(**stored_item_data)
        update_data = item.dict(exclude_unset=True)
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 1K bytes
    - Viewed (0)
  5. tests/test_ws_router.py

        # and no error is leaked
        assert caught == []
    
    
    def test_depend_err_middleware():
        """
        Verify that it is possible to write custom WebSocket middleware to catch errors
        """
    
        @websocket_middleware
        async def errorhandler(websocket: WebSocket, call_next):
            try:
                return await call_next()
            except Exception as e:
    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)
  6. tests/test_security_oauth2_optional.py

            {
                "detail": [
                    {
                        "type": "string_pattern_mismatch",
                        "loc": ["body", "grant_type"],
                        "msg": "String should match pattern 'password'",
                        "input": "incorrect",
                        "ctx": {"pattern": "password"},
                    }
                ]
            }
        ) | IsDict(
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 10.8K bytes
    - Viewed (0)
  7. tests/test_multipart_installation.py

        with pytest.raises(RuntimeError, match=multipart_incorrect_install_error):
            app = FastAPI()
    
            @app.post("/")
            async def root(f: bytes = File()):
                return f  # pragma: nocover
    
    
    def test_incorrect_multipart_installed_multi_form(monkeypatch):
        monkeypatch.delattr("multipart.multipart.parse_options_header", raising=False)
        with pytest.raises(RuntimeError, match=multipart_incorrect_install_error):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 3.7K bytes
    - Viewed (0)
  8. tests/test_ambiguous_params.py

    def test_no_annotated_defaults():
        with pytest.raises(
            AssertionError, match="Path parameters cannot have a default value"
        ):
    
            @app.get("/items/{item_id}/")
            async def get_item(item_id: Annotated[int, Path(default=1)]):
                pass  # pragma: nocover
    
        with pytest.raises(
            AssertionError,
            match=(
                "`Query` default value cannot be set in `Annotated` for 'item_id'. Set the"
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Dec 12 00:22:47 GMT 2023
    - 2.1K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_query_params_str_validations/test_tutorial010_an_py39.py

            {
                "detail": [
                    {
                        "type": "string_pattern_mismatch",
                        "loc": ["query", "item-query"],
                        "msg": "String should match pattern '^fixedquery$'",
                        "input": "nonregexquery",
                        "ctx": {"pattern": "^fixedquery$"},
                    }
                ]
            }
        ) | IsDict(
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 6.3K bytes
    - Viewed (0)
  10. scripts/docs.py

        content = en_index.read_text("utf-8")
        match_pre = re.search(r"</style>\n\n", content)
        match_start = re.search(r"<!-- sponsors -->", content)
        match_end = re.search(r"<!-- /sponsors -->", content)
        sponsors_data_path = en_docs_path / "data" / "sponsors.yml"
        sponsors = mkdocs.utils.yaml_load(sponsors_data_path.read_text(encoding="utf-8"))
        if not (match_start and match_end):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Mon Jan 22 19:26:14 GMT 2024
    - 10.9K bytes
    - Viewed (1)
Back to top