Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 28 for Elias (0.22 sec)

  1. docs_src/query_params_str_validations/tutorial010_an.py

    from fastapi import FastAPI, Query
    from typing_extensions import Annotated
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(
        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,
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Oct 24 20:26:06 GMT 2023
    - 664 bytes
    - Viewed (0)
  2. docs/zh/docs/tutorial/query-params-str-validations.md

    像下面这样:
    
    ```
    http://127.0.0.1:8000/items/?item-query=foobaritems
    ```
    
    但是 `item-query` 不是一个有效的 Python 变量名称。
    
    最接近的有效名称是 `item_query`。
    
    但是你仍然要求它在 URL 中必须是 `item-query`...
    
    这时你可以用 `alias` 参数声明一个别名,该别名将用于在 URL 中查找查询参数值:
    
    ```Python hl_lines="9"
    {!../../../docs_src/query_params_str_validations/tutorial009.py!}
    ```
    
    ## 弃用参数
    
    现在假设你不再喜欢此参数。
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 9.2K bytes
    - Viewed (0)
  3. docs_src/path_params_numeric_validations/tutorial001_py310.py

    from fastapi import FastAPI, Path, Query
    
    app = FastAPI()
    
    
    @app.get("/items/{item_id}")
    async def read_items(
        item_id: int = Path(title="The ID of the item to get"),
        q: str | None = Query(default=None, alias="item-query"),
    ):
        results = {"item_id": item_id}
        if q:
            results.update({"q": q})
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 332 bytes
    - Viewed (0)
  4. docs_src/query_params_str_validations/tutorial009_an.py

    from typing import Union
    
    from fastapi import FastAPI, Query
    from typing_extensions import Annotated
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(q: Annotated[Union[str, None], Query(alias="item-query")] = None):
        results = {"items": [{"item_id": "Foo"}, {"item_id": "Bar"}]}
        if q:
            results.update({"q": q})
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 356 bytes
    - Viewed (0)
  5. docs_src/path_params_numeric_validations/tutorial001.py

    from fastapi import FastAPI, Path, Query
    
    app = FastAPI()
    
    
    @app.get("/items/{item_id}")
    async def read_items(
        item_id: int = Path(title="The ID of the item to get"),
        q: Union[str, None] = Query(default=None, alias="item-query"),
    ):
        results = {"item_id": item_id}
        if q:
            results.update({"q": q})
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 364 bytes
    - Viewed (0)
  6. docs_src/query_params_str_validations/tutorial010_an_py39.py

    from typing import Annotated, Union
    
    from fastapi import FastAPI, Query
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(
        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,
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Oct 24 20:26:06 GMT 2023
    - 635 bytes
    - Viewed (0)
  7. docs/ko/docs/tutorial/query-params-str-validations.md

    마치 다음과 같습니다:
    
    ```
    http://127.0.0.1:8000/items/?item-query=foobaritems
    ```
    
    그러나 `item-query`은 유효한 파이썬 변수 이름이 아닙니다.
    
    가장 가까운 것은 `item_query`일 겁니다.
    
    하지만 정확히`item-query`이길 원합니다...
    
    이럴 경우 `alias`를 선언할 수 있으며, 해당 별칭은 매개변수 값을 찾는 데 사용됩니다:
    
    ```Python hl_lines="9"
    {!../../../docs_src/query_params_str_validations/tutorial009.py!}
    ```
    
    ## 매개변수 사용하지 않게 하기
    
    이제는 더이상 이 매개변수를 마음에 들어하지 않는다고 가정해 봅시다.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sun Feb 11 13:48:31 GMT 2024
    - 9.6K bytes
    - Viewed (0)
  8. docs_src/path_params_numeric_validations/tutorial001_an_py310.py

    from fastapi import FastAPI, Path, Query
    
    app = FastAPI()
    
    
    @app.get("/items/{item_id}")
    async def read_items(
        item_id: Annotated[int, Path(title="The ID of the item to get")],
        q: Annotated[str | None, Query(alias="item-query")] = None,
    ):
        results = {"item_id": item_id}
        if q:
            results.update({"q": q})
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 375 bytes
    - Viewed (0)
  9. docs_src/query_params_str_validations/tutorial010_an_py310.py

    from typing import Annotated
    
    from fastapi import FastAPI, Query
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(
        q: Annotated[
            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$",
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Oct 24 20:26:06 GMT 2023
    - 622 bytes
    - Viewed (0)
  10. tests/test_serialize_response_model.py

    from typing import Dict, List, Optional
    
    from fastapi import FastAPI
    from pydantic import BaseModel, Field
    from starlette.testclient import TestClient
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str = Field(alias="aliased_name")
        price: Optional[float] = None
        owner_ids: Optional[List[int]] = None
    
    
    @app.get("/items/valid", response_model=Item)
    def get_valid():
        return Item(aliased_name="valid", price=1.0)
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 4.2K bytes
    - Viewed (0)
Back to top