Search Options

Results per page
Sort
Preferred Languages
Advance

Results 31 - 39 of 39 for cdef (0.18 sec)

  1. docs_src/additional_responses/tutorial002.py

        "/items/{item_id}",
        response_model=Item,
        responses={
            200: {
                "content": {"image/png": {}},
                "description": "Return the JSON item or an image.",
            }
        },
    )
    async def read_item(item_id: str, img: Union[bool, None] = None):
        if img:
            return FileResponse("image.png", media_type="image/png")
        else:
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 628 bytes
    - Viewed (0)
  2. docs_src/websockets/tutorial002.py

                    input.value = ''
                    event.preventDefault()
                }
            </script>
        </body>
    </html>
    """
    
    
    @app.get("/")
    async def get():
        return HTMLResponse(html)
    
    
    async def get_cookie_or_token(
        websocket: WebSocket,
        session: Union[str, None] = Cookie(default=None),
        token: Union[str, None] = Query(default=None),
    ):
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sun Nov 13 16:10:54 GMT 2022
    - 2.8K bytes
    - Viewed (0)
  3. docs_src/separate_openapi_schemas/tutorial002.py

    
    class Item(BaseModel):
        name: str
        description: Union[str, None] = None
    
    
    app = FastAPI(separate_input_output_schemas=False)
    
    
    @app.post("/items/")
    def create_item(item: Item):
        return item
    
    
    @app.get("/items/")
    def read_items() -> List[Item]:
        return [
            Item(
                name="Portal Gun",
                description="Device to travel through the multi-rick-verse",
            ),
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Aug 25 19:10:22 GMT 2023
    - 524 bytes
    - Viewed (0)
  4. docs_src/response_status_code/tutorial002.py

    from fastapi import FastAPI, status
    
    app = FastAPI()
    
    
    @app.post("/items/", status_code=status.HTTP_201_CREATED)
    async def create_item(name: str):
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 173 bytes
    - Viewed (0)
  5. docs_src/behind_a_proxy/tutorial002.py

    from fastapi import FastAPI, Request
    
    app = FastAPI(root_path="/api/v1")
    
    
    @app.get("/app")
    def read_main(request: Request):
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Jun 11 21:53:19 GMT 2020
    - 208 bytes
    - Viewed (0)
  6. docs_src/body_nested_models/tutorial002.py

    
    class Item(BaseModel):
        name: str
        description: Union[str, None] = None
        price: float
        tax: Union[float, None] = None
        tags: List[str] = []
    
    
    @app.put("/items/{item_id}")
    async def update_item(item_id: int, item: Item):
        results = {"item_id": item_id, "item": item}
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 413 bytes
    - Viewed (0)
  7. docs_src/response_directly/tutorial002.py

    from fastapi import FastAPI, Response
    
    app = FastAPI()
    
    
    @app.get("/legacy/")
    def get_legacy_data():
        data = """<?xml version="1.0"?>
        <shampoo>
        <Header>
            Apply shampoo here.
        </Header>
        <Body>
            You'll have to use soap here.
        </Body>
        </shampoo>
        """
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 354 bytes
    - Viewed (0)
  8. docs_src/body_multiple_params/tutorial002.py

        price: float
        tax: Union[float, None] = None
    
    
    class User(BaseModel):
        username: str
        full_name: Union[str, None] = None
    
    
    @app.put("/items/{item_id}")
    async def update_item(item_id: int, item: Item, user: User):
        results = {"item_id": item_id, "item": item, "user": user}
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 490 bytes
    - Viewed (0)
  9. docs_src/schema_extra_example/tutorial002.py

        price: float = Field(examples=[35.4])
        tax: Union[float, None] = Field(default=None, examples=[3.2])
    
    
    @app.put("/items/{item_id}")
    async def update_item(item_id: int, item: Item):
        results = {"item_id": item_id, "item": item}
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 517 bytes
    - Viewed (0)
Back to top