Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 8 of 8 for Read (0.2 sec)

  1. docs_src/path_operation_configuration/tutorial006.py

    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    @app.get("/items/", tags=["items"])
    async def read_items():
        return [{"name": "Foo", "price": 42}]
    
    
    @app.get("/users/", tags=["users"])
    async def read_users():
        return [{"username": "johndoe"}]
    
    
    @app.get("/elements/", tags=["items"], deprecated=True)
    async def read_elements():
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 365 bytes
    - Viewed (0)
  2. docs_src/query_params/tutorial006.py

    from typing import Union
    
    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    @app.get("/items/{item_id}")
    async def read_user_item(
        item_id: str, needy: str, skip: int = 0, limit: Union[int, None] = None
    ):
        item = {"item_id": item_id, "needy": needy, "skip": skip, "limit": limit}
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 301 bytes
    - Viewed (0)
  3. docs_src/query_params_str_validations/tutorial006.py

    from fastapi import FastAPI, Query
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(q: str = Query(min_length=3)):
        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: Fri May 13 23:38:22 GMT 2022
    - 254 bytes
    - Viewed (0)
  4. docs_src/path_params_numeric_validations/tutorial006.py

    from fastapi import FastAPI, Path, Query
    
    app = FastAPI()
    
    
    @app.get("/items/{item_id}")
    async def read_items(
        *,
        item_id: int = Path(title="The ID of the item to get", ge=0, le=1000),
        q: str,
        size: float = Query(gt=0, lt=10.5),
    ):
        results = {"item_id": item_id}
        if q:
            results.update({"q": q})
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Mar 10 18:49:18 GMT 2023
    - 345 bytes
    - Viewed (0)
  5. docs_src/response_model/tutorial006.py

    
    @app.get(
        "/items/{item_id}/name",
        response_model=Item,
        response_model_include=["name", "description"],
    )
    async def read_item_name(item_id: str):
        return items[item_id]
    
    
    @app.get("/items/{item_id}/public", response_model=Item, response_model_exclude=["tax"])
    async def read_item_public_data(item_id: str):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 848 bytes
    - Viewed (0)
  6. docs_src/handling_errors/tutorial006.py

    async def validation_exception_handler(request, exc):
        print(f"OMG! The client sent invalid data!: {exc}")
        return await request_validation_exception_handler(request, exc)
    
    
    @app.get("/items/{item_id}")
    async def read_item(item_id: int):
        if item_id == 3:
            raise HTTPException(status_code=418, detail="Nope! I don't like 3.")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sun Aug 09 11:10:33 GMT 2020
    - 928 bytes
    - Viewed (0)
  7. docs_src/security/tutorial006.py

    from fastapi import Depends, FastAPI
    from fastapi.security import HTTPBasic, HTTPBasicCredentials
    
    app = FastAPI()
    
    security = HTTPBasic()
    
    
    @app.get("/users/me")
    def read_current_user(credentials: HTTPBasicCredentials = Depends(security)):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 321 bytes
    - Viewed (0)
  8. docs_src/dependencies/tutorial006.py

            raise HTTPException(status_code=400, detail="X-Key header invalid")
        return x_key
    
    
    @app.get("/items/", dependencies=[Depends(verify_token), Depends(verify_key)])
    async def read_items():
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 583 bytes
    - Viewed (0)
Back to top