Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 395 for Lyding (0.15 sec)

  1. docs_src/security/tutorial006_an_py39.py

    from typing import Annotated
    
    from fastapi import Depends, FastAPI
    from fastapi.security import HTTPBasic, HTTPBasicCredentials
    
    app = FastAPI()
    
    security = HTTPBasic()
    
    
    @app.get("/users/me")
    def read_current_user(credentials: Annotated[HTTPBasicCredentials, Depends(security)]):
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 361 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}
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Sat May 14 11:59:59 UTC 2022
    - 301 bytes
    - Viewed (0)
  3. docs_src/query_params_str_validations/tutorial007_an.py

    from typing import Union
    
    from fastapi import FastAPI, Query
    from typing_extensions import Annotated
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(
        q: Annotated[Union[str, None], Query(title="Query string", min_length=3)] = None,
    ):
        results = {"items": [{"item_id": "Foo"}, {"item_id": "Bar"}]}
        if q:
            results.update({"q": q})
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Tue Mar 26 16:56:53 UTC 2024
    - 379 bytes
    - Viewed (0)
  4. docs_src/response_model/tutorial003_04.py

    from typing import Union
    
    from fastapi import FastAPI, Response
    from fastapi.responses import RedirectResponse
    
    app = FastAPI()
    
    
    @app.get("/portal")
    async def get_portal(teleport: bool = False) -> Union[Response, dict]:
        if teleport:
            return RedirectResponse(url="https://www.youtube.com/watch?v=dQw4w9WgXcQ")
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Tue Jan 10 16:22:47 UTC 2023
    - 384 bytes
    - Viewed (0)
  5. docs_src/settings/app03_an/main.py

    from functools import lru_cache
    from typing import Annotated
    
    from fastapi import Depends, FastAPI
    
    from . import config
    
    app = FastAPI()
    
    
    @lru_cache
    def get_settings():
        return config.Settings()
    
    
    @app.get("/info")
    async def info(settings: Annotated[config.Settings, Depends(get_settings)]):
        return {
            "app_name": settings.app_name,
            "admin_email": settings.admin_email,
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Tue Oct 24 20:26:06 UTC 2023
    - 451 bytes
    - Viewed (0)
  6. docs_src/body_nested_models/tutorial001.py

    from typing import Union
    
    from fastapi import FastAPI
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: Union[str, None] = None
        price: float
        tax: Union[float, None] = None
        tags: list = []
    
    
    @app.put("/items/{item_id}")
    async def update_item(item_id: int, item: Item):
        results = {"item_id": item_id, "item": item}
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Sat May 14 11:59:59 UTC 2022
    - 402 bytes
    - Viewed (0)
  7. docs_src/body_multiple_params/tutorial005.py

    from typing import Union
    
    from fastapi import Body, FastAPI
    from pydantic import BaseModel
    
    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(embed=True)):
        results = {"item_id": item_id, "item": item}
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Fri May 13 23:38:22 UTC 2022
    - 407 bytes
    - Viewed (0)
  8. docs_src/custom_response/tutorial009c.py

    from typing import Any
    
    import orjson
    from fastapi import FastAPI, Response
    
    app = FastAPI()
    
    
    class CustomORJSONResponse(Response):
        media_type = "application/json"
    
        def render(self, content: Any) -> bytes:
            assert orjson is not None, "orjson must be installed"
            return orjson.dumps(content, option=orjson.OPT_INDENT_2)
    
    
    @app.get("/", response_class=CustomORJSONResponse)
    async def main():
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Thu Sep 01 09:32:30 UTC 2022
    - 451 bytes
    - Viewed (0)
  9. docs_src/request_files/tutorial001_03_an_py39.py

    from typing import Annotated
    
    from fastapi import FastAPI, File, UploadFile
    
    app = FastAPI()
    
    
    @app.post("/files/")
    async def create_file(file: Annotated[bytes, File(description="A file read as bytes")]):
        return {"file_size": len(file)}
    
    
    @app.post("/uploadfile/")
    async def create_upload_file(
        file: Annotated[UploadFile, File(description="A file read as UploadFile")],
    ):
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 421 bytes
    - Viewed (0)
  10. docs_src/response_model/tutorial003.py

    from typing import Any, Union
    
    from fastapi import FastAPI
    from pydantic import BaseModel, EmailStr
    
    app = FastAPI()
    
    
    class UserIn(BaseModel):
        username: str
        password: str
        email: EmailStr
        full_name: Union[str, None] = None
    
    
    class UserOut(BaseModel):
        username: str
        email: EmailStr
        full_name: Union[str, None] = None
    
    
    @app.post("/user/", response_model=UserOut)
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Sat Jan 07 13:45:48 UTC 2023
    - 450 bytes
    - Viewed (0)
Back to top