Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 174 for set (0.17 sec)

  1. tests/test_reponse_set_reponse_code_empty.py

    async def delete_deployment(
        id: int,
        response: Response,
    ) -> Any:
        response.status_code = 400
        return {"msg": "Status overwritten", "id": id}
    
    
    client = TestClient(app)
    
    
    def test_dependency_set_status_code():
        response = client.delete("/1")
        assert response.status_code == 400 and response.content
        assert response.json() == {"msg": "Status overwritten", "id": 1}
    
    
    def test_openapi_schema():
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 3.1K bytes
    - Viewed (0)
  2. docs_src/path_operation_advanced_configuration/tutorial004.py

    from typing import Set, Union
    
    from fastapi import FastAPI
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: Union[str, None] = None
        price: float
        tax: Union[float, None] = None
        tags: Set[str] = set()
    
    
    @app.post("/items/", response_model=Item, summary="Create an item")
    async def create_item(item: Item):
        """
        Create an item with all the information:
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 717 bytes
    - Viewed (0)
  3. docs/en/docs/tutorial/metadata.md

    * **Swagger UI**: served at `/docs`.
        * You can set its URL with the parameter `docs_url`.
        * You can disable it by setting `docs_url=None`.
    * **ReDoc**: served at `/redoc`.
        * You can set its URL with the parameter `redoc_url`.
        * You can disable it by setting `redoc_url=None`.
    
    For example, to set Swagger UI to be served at `/documentation` and disable ReDoc:
    
    ```Python hl_lines="3"
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sun Mar 31 23:52:53 GMT 2024
    - 5.8K bytes
    - Viewed (0)
  4. docs_src/body_nested_models/tutorial003.py

    from typing import Set, Union
    
    from fastapi import FastAPI
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: Union[str, None] = None
        price: float
        tax: Union[float, None] = None
        tags: Set[str] = set()
    
    
    @app.put("/items/{item_id}")
    async def update_item(item_id: int, item: Item):
        results = {"item_id": item_id, "item": item}
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 414 bytes
    - Viewed (0)
  5. docs_src/path_operation_configuration/tutorial002.py

    from typing import Set, Union
    
    from fastapi import FastAPI
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: Union[str, None] = None
        price: float
        tax: Union[float, None] = None
        tags: Set[str] = set()
    
    
    @app.post("/items/", response_model=Item, tags=["items"])
    async def create_item(item: Item):
        return item
    
    
    @app.get("/items/", tags=["items"])
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 580 bytes
    - Viewed (0)
  6. docs_src/path_operation_configuration/tutorial004_py310.py

    from fastapi import FastAPI
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: str | None = None
        price: float
        tax: float | None = None
        tags: set[str] = set()
    
    
    @app.post("/items/", response_model=Item, summary="Create an item")
    async def create_item(item: Item):
        """
        Create an item with all the information:
    
        - **name**: each item must have a name
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 638 bytes
    - Viewed (0)
  7. tests/test_dependency_contextvars.py

        "legacy_request_state_context_var", default=None
    )
    
    app = FastAPI()
    
    
    async def set_up_request_state_dependency():
        request_state = {"user": "deadpond"}
        contextvar_token = legacy_request_state_context_var.set(request_state)
        yield request_state
        legacy_request_state_context_var.reset(contextvar_token)
    
    
    @app.middleware("http")
    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)
  8. docs_src/path_operation_configuration/tutorial002_py39.py

    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: Union[str, None] = None
        price: float
        tax: Union[float, None] = None
        tags: set[str] = set()
    
    
    @app.post("/items/", response_model=Item, tags=["items"])
    async def create_item(item: Item):
        return item
    
    
    @app.get("/items/", tags=["items"])
    async def read_items():
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 575 bytes
    - Viewed (0)
  9. docs/ja/docs/tutorial/extra-data-types.md

    * `frozenset`:
        * リクエストとレスポンスでは`set`と同じように扱われます:
            * リクエストでは、リストが読み込まれ、重複を排除して`set`に変換されます。
            * レスポンスでは`set`が`list`に変換されます。
            * 生成されたスキーマは`set`の値が一意であることを指定します(JSON Schemaの`uniqueItems`を使用します)。
    * `bytes`:
        * Pythonの標準的な`bytes`です。
        * リクエストとレスポンスでは`str`として扱われます。
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 3.2K bytes
    - Viewed (0)
  10. scripts/publish.sh

    #!/usr/bin/env bash
    
    set -e
    
    Shell Script
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Apr 20 18:09:35 GMT 2019
    - 42 bytes
    - Viewed (0)
Back to top