Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 6 of 6 for bhar (0.19 sec)

  1. docs_src/events/tutorial001.py

    from fastapi import FastAPI
    
    app = FastAPI()
    
    items = {}
    
    
    @app.on_event("startup")
    async def startup_event():
        items["foo"] = {"name": "Fighters"}
        items["bar"] = {"name": "Tenders"}
    
    
    @app.get("/items/{item_id}")
    async def read_items(item_id: str):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 283 bytes
    - Viewed (0)
  2. docs_src/body_updates/tutorial001.py

        description: Union[str, None] = None
        price: Union[float, None] = None
        tax: float = 10.5
        tags: List[str] = []
    
    
    items = {
        "foo": {"name": "Foo", "price": 50.2},
        "bar": {"name": "Bar", "description": "The bartenders", "price": 62, "tax": 20.2},
        "baz": {"name": "Baz", "description": None, "price": 50.2, "tax": 10.5, "tags": []},
    }
    
    
    @app.get("/items/{item_id}", response_model=Item)
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 906 bytes
    - Viewed (0)
  3. docs_src/query_params_str_validations/tutorial001.py

    from typing import Union
    
    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(q: Union[str, None] = 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: Sat May 14 11:59:59 GMT 2022
    - 271 bytes
    - Viewed (0)
  4. docs_src/query_params/tutorial001.py

    from fastapi import FastAPI
    
    app = FastAPI()
    
    fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
    
    
    @app.get("/items/")
    async def read_item(skip: int = 0, limit: int = 10):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 250 bytes
    - Viewed (0)
  5. docs_src/response_change_status_code/tutorial001.py

    from fastapi import FastAPI, Response, status
    
    app = FastAPI()
    
    tasks = {"foo": "Listen to the Bar Fighters"}
    
    
    @app.put("/get-or-create-task/{task_id}", status_code=200)
    def get_or_create_task(task_id: str, response: Response):
        if task_id not in tasks:
            tasks[task_id] = "This didn't exist before"
            response.status_code = status.HTTP_201_CREATED
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 391 bytes
    - Viewed (0)
  6. docs_src/additional_status_codes/tutorial001.py

    from typing import Union
    
    from fastapi import Body, FastAPI, status
    from fastapi.responses import JSONResponse
    
    app = FastAPI()
    
    items = {"foo": {"name": "Fighters", "size": 6}, "bar": {"name": "Tenders", "size": 3}}
    
    
    @app.put("/items/{item_id}")
    async def upsert_item(
        item_id: str,
        name: Union[str, None] = Body(default=None),
        size: Union[int, None] = Body(default=None),
    ):
        if item_id in items:
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 684 bytes
    - Viewed (0)
Back to top