Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 18 for sync (0.19 sec)

  1. docs_src/schema_extra_example/tutorial004.py

    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: Union[str, None] = None
        price: float
        tax: Union[float, None] = None
    
    
    @app.put("/items/{item_id}")
    async def update_item(
        *,
        item_id: int,
        item: Item = Body(
            examples=[
                {
                    "name": "Foo",
                    "description": "A very nice Item",
                    "price": 35.4,
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Jul 01 16:43:29 GMT 2023
    - 824 bytes
    - Viewed (0)
  2. docs_src/dependencies/tutorial004.py

    
    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()):
        response = {}
        if commons.q:
            response.update({"q": commons.q})
        items = fake_items_db[commons.skip : commons.skip + commons.limit]
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 639 bytes
    - Viewed (0)
  3. docs_src/security/tutorial004.py

        if user is None:
            raise credentials_exception
        return user
    
    
    async def get_current_active_user(current_user: User = Depends(get_current_user)):
        if current_user.disabled:
            raise HTTPException(status_code=400, detail="Inactive user")
        return current_user
    
    
    @app.post("/token")
    async def login_for_access_token(
        form_data: OAuth2PasswordRequestForm = Depends(),
    ) -> Token:
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Mar 26 16:56:53 GMT 2024
    - 4K bytes
    - Viewed (0)
  4. docs_src/body_nested_models/tutorial004.py

        name: str
        description: Union[str, None] = None
        price: float
        tax: Union[float, None] = None
        tags: Set[str] = set()
        image: Union[Image, None] = None
    
    
    @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
    - 504 bytes
    - Viewed (0)
  5. docs_src/response_model/tutorial004.py

        "baz": {"name": "Baz", "description": None, "price": 50.2, "tax": 10.5, "tags": []},
    }
    
    
    @app.get("/items/{item_id}", response_model=Item, response_model_exclude_unset=True)
    async def read_item(item_id: str):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 633 bytes
    - Viewed (0)
  6. docs_src/handling_errors/tutorial004.py

    
    @app.exception_handler(StarletteHTTPException)
    async def http_exception_handler(request, exc):
        return PlainTextResponse(str(exc.detail), status_code=exc.status_code)
    
    
    @app.exception_handler(RequestValidationError)
    async def validation_exception_handler(request, exc):
        return PlainTextResponse(str(exc), status_code=400)
    
    
    @app.get("/items/{item_id}")
    async def read_item(item_id: int):
        if item_id == 3:
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 762 bytes
    - Viewed (0)
  7. docs_src/metadata/tutorial004.py

            },
        },
    ]
    
    app = FastAPI(openapi_tags=tags_metadata)
    
    
    @app.get("/users/", tags=["users"])
    async def get_users():
        return [{"name": "Harry"}, {"name": "Ron"}]
    
    
    @app.get("/items/", tags=["items"])
    async def get_items():
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Jun 13 11:58:06 GMT 2020
    - 693 bytes
    - Viewed (0)
  8. docs_src/path_params_numeric_validations/tutorial004.py

    from fastapi import FastAPI, Path
    
    app = FastAPI()
    
    
    @app.get("/items/{item_id}")
    async def read_items(
        *, item_id: int = Path(title="The ID of the item to get", ge=1), q: str
    ):
        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
    - 280 bytes
    - Viewed (0)
  9. docs_src/body/tutorial004.py

    
    class Item(BaseModel):
        name: str
        description: Union[str, None] = None
        price: float
        tax: Union[float, None] = None
    
    
    app = FastAPI()
    
    
    @app.put("/items/{item_id}")
    async def update_item(item_id: int, item: Item, q: Union[str, None] = None):
        result = {"item_id": item_id, **item.dict()}
        if q:
            result.update({"q": q})
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Jan 09 14:28:58 GMT 2024
    - 452 bytes
    - Viewed (0)
  10. docs_src/path_params/tutorial004.py

    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    @app.get("/files/{file_path:path}")
    async def read_file(file_path: str):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Mar 27 16:15:26 GMT 2020
    - 156 bytes
    - Viewed (0)
Back to top