Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 8 of 8 for init (0.15 sec)

  1. docs_src/dependencies/tutorial002.py

    from fastapi import Depends, FastAPI
    
    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/")
    async def read_items(commons: CommonQueryParams = Depends(CommonQueryParams)):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 656 bytes
    - Viewed (0)
  2. docs_src/path_params/tutorial002.py

    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    @app.get("/items/{item_id}")
    async def read_item(item_id: int):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 143 bytes
    - Viewed (0)
  3. docs_src/path_params_numeric_validations/tutorial002.py

    from fastapi import FastAPI, Path
    
    app = FastAPI()
    
    
    @app.get("/items/{item_id}")
    async def read_items(q: str, item_id: int = Path(title="The ID of the item to get")):
        results = {"item_id": item_id}
        if q:
            results.update({"q": q})
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 265 bytes
    - Viewed (0)
  4. docs_src/custom_request_and_route/tutorial002.py

            return custom_route_handler
    
    
    app = FastAPI()
    app.router.route_class = ValidationErrorLoggingRoute
    
    
    @app.post("/")
    async def sum_numbers(numbers: List[int] = Body()):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 932 bytes
    - Viewed (0)
  5. 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 Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 413 bytes
    - Viewed (0)
  6. 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 Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 490 bytes
    - Viewed (0)
  7. 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 Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 517 bytes
    - Viewed (0)
  8. docs_src/websockets/tutorial002.py

        return session or token
    
    
    @app.websocket("/items/{item_id}/ws")
    async def websocket_endpoint(
        websocket: WebSocket,
        item_id: str,
        q: Union[int, None] = None,
        cookie_or_token: str = Depends(get_cookie_or_token),
    ):
        await websocket.accept()
        while True:
            data = await websocket.receive_text()
            await websocket.send_text(
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sun Nov 13 16:10:54 GMT 2022
    - 2.8K bytes
    - Viewed (0)
Back to top