Search Options

Results per page
Sort
Preferred Languages
Advance

Results 21 - 30 of 83 for plumbus (0.17 sec)

  1. docs_src/dependencies/tutorial008c_an.py

        if item_id == "portal-gun":
            raise InternalError(
                f"The portal gun is too dangerous to be owned by {username}"
            )
        if item_id != "plumbus":
            raise HTTPException(
                status_code=404, detail="Item not found, there's only a plumbus here"
            )
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Sat Feb 24 23:06:37 UTC 2024
    - 710 bytes
    - Viewed (0)
  2. docs_src/dependencies/tutorial008b_an_py39.py

    from typing import Annotated
    
    from fastapi import Depends, FastAPI, HTTPException
    
    app = FastAPI()
    
    
    data = {
        "plumbus": {"description": "Freshly pickled plumbus", "owner": "Morty"},
        "portal-gun": {"description": "Gun to create portals", "owner": "Rick"},
    }
    
    
    class OwnerError(Exception):
        pass
    
    
    def get_username():
        try:
            yield "Rick"
        except OwnerError as e:
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Tue Dec 26 20:37:34 UTC 2023
    - 775 bytes
    - Viewed (0)
  3. docs_src/separate_openapi_schemas/tutorial002.py

    @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: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Fri Aug 25 19:10:22 UTC 2023
    - 524 bytes
    - Viewed (0)
  4. docs_src/response_model/tutorial001_py39.py

    async def create_item(item: Item) -> Any:
        return item
    
    
    @app.get("/items/", response_model=list[Item])
    async def read_items() -> Any:
        return [
            {"name": "Portal Gun", "price": 42.0},
            {"name": "Plumbus", "price": 32.0},
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Sat Jan 07 13:45:48 UTC 2023
    - 556 bytes
    - Viewed (0)
  5. docs_src/separate_openapi_schemas/tutorial002_py39.py

    @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: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Fri Aug 25 19:10:22 UTC 2023
    - 518 bytes
    - Viewed (0)
  6. tests/test_tutorial/test_dependencies/test_tutorial008b.py

        response = client.get("/items/foo")
        assert response.status_code == 404, response.text
        assert response.json() == {"detail": "Item not found"}
    
    
    def test_owner_error():
        response = client.get("/items/plumbus")
        assert response.status_code == 400, response.text
        assert response.json() == {"detail": "Owner error: Rick"}
    
    
    def test_get_item():
        response = client.get("/items/portal-gun")
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Tue Dec 26 20:37:34 UTC 2023
    - 697 bytes
    - Viewed (0)
  7. docs_src/dependencies/tutorial012_an_py39.py

        return x_key
    
    
    app = FastAPI(dependencies=[Depends(verify_token), Depends(verify_key)])
    
    
    @app.get("/items/")
    async def read_items():
        return [{"item": "Portal Gun"}, {"item": "Plumbus"}]
    
    
    @app.get("/users/")
    async def read_users():
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 756 bytes
    - Viewed (0)
  8. docs_src/response_model/tutorial001_01_py310.py

    @app.post("/items/")
    async def create_item(item: Item) -> Item:
        return item
    
    
    @app.get("/items/")
    async def read_items() -> list[Item]:
        return [
            Item(name="Portal Gun", price=42.0),
            Item(name="Plumbus", price=32.0),
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Sat Jan 07 13:45:48 UTC 2023
    - 469 bytes
    - Viewed (0)
  9. docs_src/separate_openapi_schemas/tutorial001.py

    @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: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Fri Aug 25 19:10:22 UTC 2023
    - 489 bytes
    - Viewed (0)
  10. docs_src/generate_clients/tutorial003_py39.py

    async def create_item(item: Item):
        return {"message": "Item received"}
    
    
    @app.get("/items/", response_model=list[Item], tags=["items"])
    async def get_items():
        return [
            {"name": "Plumbus", "price": 3},
            {"name": "Portal Gun", "price": 9001},
        ]
    
    
    @app.post("/users/", response_model=ResponseMessage, tags=["users"])
    async def create_user(user: User):
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Fri Mar 04 22:02:18 UTC 2022
    - 914 bytes
    - Viewed (0)
Back to top