Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 266 for rick (0.01 sec)

  1. docs_src/dependencies/tutorial008c_an_py39.py

    from typing import Annotated
    
    from fastapi import Depends, FastAPI, HTTPException
    
    app = FastAPI()
    
    
    class InternalError(Exception):
        pass
    
    
    def get_username():
        try:
            yield "Rick"
        except InternalError:
            print("Oops, we didn't raise again, Britney 😱")
    
    
    @app.get("/items/{item_id}")
    def get_item(item_id: str, username: Annotated[str, Depends(get_username)]):
        if item_id == "portal-gun":
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Feb 24 23:06:37 UTC 2024
    - 700 bytes
    - Viewed (0)
  2. docs/uk/docs/tutorial/query-params-str-validations.md

    ```Python
    q: Annotated[str, Query(default="rick")] = "morty"
    ```
    
    ...тому, що не зрозуміло, яке значення має бути значенням за замовчуванням: `"rick"` чи `"morty"`.
    
    Коректні варіанти:
    
    ```Python
    q: Annotated[str, Query()] = "rick"
    ```
    
    ...або у старих кодових базах Ви знайдете:
    
    ```Python
    q: str = Query(default="rick")
    ```
    
    ### Переваги використання `Annotated`
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri May 30 14:17:24 UTC 2025
    - 26.1K bytes
    - Viewed (0)
  3. docs_src/dependencies/tutorial008e_py39.py

    from fastapi import Depends, FastAPI
    
    app = FastAPI()
    
    
    def get_username():
        try:
            yield "Rick"
        finally:
            print("Cleanup up before response is sent")
    
    
    @app.get("/users/me")
    def get_user_me(username: str = Depends(get_username, scope="function")):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 289 bytes
    - Viewed (0)
  4. docs_src/separate_openapi_schemas/tutorial001_py310.py

        return item
    
    
    @app.get("/items/")
    def read_items() -> list[Item]:
        return [
            Item(
                name="Portal Gun",
                description="Device to travel through the multi-rick-verse",
            ),
            Item(name="Plumbus"),
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Aug 25 19:10:22 UTC 2023
    - 451 bytes
    - Viewed (0)
  5. docs_src/separate_openapi_schemas/tutorial002_py310.py

        return item
    
    
    @app.get("/items/")
    def read_items() -> list[Item]:
        return [
            Item(
                name="Portal Gun",
                description="Device to travel through the multi-rick-verse",
            ),
            Item(name="Plumbus"),
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Aug 25 19:10:22 UTC 2023
    - 486 bytes
    - Viewed (0)
  6. tests/test_tutorial/test_dependencies/test_tutorial008e.py

        client = TestClient(mod.app)
        return client
    
    
    def test_get_users_me(client: TestClient):
        response = client.get("/users/me")
        assert response.status_code == 200, response.text
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 574 bytes
    - Viewed (0)
  7. docs_src/path_operation_configuration/tutorial002b_py39.py

        users = "users"
    
    
    @app.get("/items/", tags=[Tags.items])
    async def get_items():
        return ["Portal gun", "Plumbus"]
    
    
    @app.get("/users/", tags=[Tags.users])
    async def read_users():
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 323 bytes
    - Viewed (0)
  8. docs_src/bigger_applications/app_an_py39/routers/users.py

    from fastapi import APIRouter
    
    router = APIRouter()
    
    
    @router.get("/users/", tags=["users"])
    async def read_users():
        return [{"username": "Rick"}, {"username": "Morty"}]
    
    
    @router.get("/users/me", tags=["users"])
    async def read_user_me():
        return {"username": "fakecurrentuser"}
    
    
    @router.get("/users/{username}", tags=["users"])
    async def read_user(username: str):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 407 bytes
    - Viewed (0)
  9. docs_src/bigger_applications/app_py39/routers/users.py

    from fastapi import APIRouter
    
    router = APIRouter()
    
    
    @router.get("/users/", tags=["users"])
    async def read_users():
        return [{"username": "Rick"}, {"username": "Morty"}]
    
    
    @router.get("/users/me", tags=["users"])
    async def read_user_me():
        return {"username": "fakecurrentuser"}
    
    
    @router.get("/users/{username}", tags=["users"])
    async def read_user(username: str):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 407 bytes
    - Viewed (0)
  10. docs_src/dependencies/tutorial008c_py39.py

    from fastapi import Depends, FastAPI, HTTPException
    
    app = FastAPI()
    
    
    class InternalError(Exception):
        pass
    
    
    def get_username():
        try:
            yield "Rick"
        except InternalError:
            print("Oops, we didn't raise again, Britney 😱")
    
    
    @app.get("/items/{item_id}")
    def get_item(item_id: str, username: str = Depends(get_username)):
        if item_id == "portal-gun":
            raise InternalError(
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 660 bytes
    - Viewed (0)
Back to top