Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 452 for Lyding (0.16 sec)

  1. tests/test_typing_python39.py

    from fastapi import FastAPI
    from fastapi.testclient import TestClient
    
    from .utils import needs_py310
    
    
    @needs_py310
    def test_typing():
        types = {
            list[int]: [1, 2, 3],
            dict[str, list[int]]: {"a": [1, 2, 3], "b": [4, 5, 6]},
            set[int]: [1, 2, 3],  # `set` is converted to `list`
            tuple[int, ...]: [1, 2, 3],  # `tuple` is converted to `list`
        }
        for test_type, expect in types.items():
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 709 bytes
    - Viewed (0)
  2. docs_src/query_params_str_validations/tutorial012_an.py

    from typing import List
    
    from fastapi import FastAPI, Query
    from typing_extensions import Annotated
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(q: Annotated[List[str], Query()] = ["foo", "bar"]):
        query_items = {"q": q}
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 262 bytes
    - Viewed (0)
  3. docs_src/query_params_str_validations/tutorial003_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(min_length=3, max_length=50)] = None,
    ):
        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 Mar 26 16:56:53 GMT 2024
    - 372 bytes
    - Viewed (0)
  4. docs_src/path_params_numeric_validations/tutorial001_an.py

    from typing import Union
    
    from fastapi import FastAPI, Path, Query
    from typing_extensions import Annotated
    
    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[Union[str, None], Query(alias="item-query")] = None,
    ):
        results = {"item_id": item_id}
        if q:
            results.update({"q": q})
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 417 bytes
    - Viewed (0)
  5. docs_src/schema_extra_example/tutorial004_an.py

    from typing import Union
    
    from fastapi import Body, FastAPI
    from pydantic import BaseModel
    from typing_extensions import Annotated
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: Union[str, None] = None
        price: float
        tax: Union[float, None] = None
    
    
    @app.put("/items/{item_id}")
    async def update_item(
        *,
        item_id: int,
        item: Annotated[
            Item,
            Body(
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Jul 01 16:43:29 GMT 2023
    - 965 bytes
    - Viewed (0)
  6. docs_src/dependencies/tutorial003_an.py

    from typing import Any, Union
    
    from fastapi import Depends, FastAPI
    from typing_extensions import Annotated
    
    app = FastAPI()
    
    
    fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
    
    
    class CommonQueryParams:
        def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100):
            self.q = q
            self.skip = skip
            self.limit = limit
    
    
    @app.get("/items/")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 697 bytes
    - Viewed (0)
  7. tests/test_ws_dependencies.py

    import json
    from typing import List
    
    from fastapi import APIRouter, Depends, FastAPI, WebSocket
    from fastapi.testclient import TestClient
    from typing_extensions import Annotated
    
    
    def dependency_list() -> List[str]:
        return []
    
    
    DepList = Annotated[List[str], Depends(dependency_list)]
    
    
    def create_dependency(name: str):
        def fun(deps: DepList):
            deps.append(name)
    
        return Depends(fun)
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sun Jun 11 20:35:39 GMT 2023
    - 2.1K bytes
    - Viewed (0)
  8. tests/test_additional_responses_response_class.py

    import typing
    
    from fastapi import FastAPI
    from fastapi.responses import JSONResponse
    from fastapi.testclient import TestClient
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class JsonApiResponse(JSONResponse):
        media_type = "application/vnd.api+json"
    
    
    class Error(BaseModel):
        status: str
        title: str
    
    
    class JsonApiError(BaseModel):
        errors: typing.List[Error]
    
    
    @app.get(
        "/a",
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 3.5K bytes
    - Viewed (0)
  9. tests/test_response_code_no_body.py

    import typing
    
    from fastapi import FastAPI
    from fastapi.responses import JSONResponse
    from fastapi.testclient import TestClient
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class JsonApiResponse(JSONResponse):
        media_type = "application/vnd.api+json"
    
    
    class Error(BaseModel):
        status: str
        title: str
    
    
    class JsonApiError(BaseModel):
        errors: typing.List[Error]
    
    
    @app.get(
        "/a",
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 3.2K bytes
    - Viewed (0)
  10. docs_src/request_forms/tutorial001_an.py

    from fastapi import FastAPI, Form
    from typing_extensions import Annotated
    
    app = FastAPI()
    
    
    @app.post("/login/")
    async def login(username: Annotated[str, Form()], password: Annotated[str, Form()]):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 233 bytes
    - Viewed (0)
Back to top