Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 69 for 404 (0.15 sec)

  1. tests/test_generate_unique_id_function.py

        router = APIRouter()
    
        @app.post("/", response_model=List[Item], responses={404: {"model": List[Message]}})
        def post_root(item1: Item, item2: Item):
            return item1, item2  # pragma: nocover
    
        @router.post(
            "/router", response_model=List[Item], responses={404: {"model": List[Message]}}
        )
        def post_router(item1: Item, item2: Item):
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Sat Jan 13 15:10:26 GMT 2024
    - 66.7K bytes
    - Viewed (0)
  2. docs_src/additional_responses/tutorial001.py

    class Message(BaseModel):
        message: str
    
    
    app = FastAPI()
    
    
    @app.get("/items/{item_id}", response_model=Item, responses={404: {"model": Message}})
    async def read_item(item_id: str):
        if item_id == "foo":
            return {"id": "foo", "value": "there goes my hero"}
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Aug 26 13:32:30 GMT 2022
    - 506 bytes
    - Viewed (0)
  3. docs_src/bigger_applications/app/routers/items.py

        responses={404: {"description": "Not found"}},
    )
    
    
    fake_items_db = {"plumbus": {"name": "Plumbus"}, "gun": {"name": "Portal Gun"}}
    
    
    @router.get("/")
    async def read_items():
        return fake_items_db
    
    
    @router.get("/{item_id}")
    async def read_item(item_id: str):
        if item_id not in fake_items_db:
            raise HTTPException(status_code=404, detail="Item not found")
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Sun Nov 29 17:32:18 GMT 2020
    - 1011 bytes
    - Viewed (0)
  4. docs_src/bigger_applications/app_an/routers/items.py

        responses={404: {"description": "Not found"}},
    )
    
    
    fake_items_db = {"plumbus": {"name": "Plumbus"}, "gun": {"name": "Portal Gun"}}
    
    
    @router.get("/")
    async def read_items():
        return fake_items_db
    
    
    @router.get("/{item_id}")
    async def read_item(item_id: str):
        if item_id not in fake_items_db:
            raise HTTPException(status_code=404, detail="Item not found")
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 1011 bytes
    - Viewed (0)
  5. docs_src/dependencies/tutorial008d.py

            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"
            )
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Sat Feb 24 23:06:37 GMT 2024
    - 694 bytes
    - Viewed (0)
  6. docs_src/dependencies/tutorial008d_an.py

            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"
            )
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Sat Feb 24 23:06:37 GMT 2024
    - 744 bytes
    - Viewed (0)
  7. docs_src/dependencies/tutorial008d_an_py39.py

            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"
            )
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Sat Feb 24 23:06:37 GMT 2024
    - 734 bytes
    - Viewed (0)
  8. tests/test_tutorial/test_dependencies/test_tutorial008b.py

    from fastapi.testclient import TestClient
    
    from docs_src.dependencies.tutorial008b import app
    
    client = TestClient(app)
    
    
    def test_get_no_item():
        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
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Tue Dec 26 20:37:34 GMT 2023
    - 697 bytes
    - Viewed (0)
  9. tests/test_tutorial/test_additional_responses/test_tutorial001.py

        assert response.json() == {"id": "foo", "value": "there goes my hero"}
    
    
    def test_path_operation_not_found():
        response = client.get("/items/bar")
        assert response.status_code == 404, response.text
        assert response.json() == {"message": "Item not found"}
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 4.3K bytes
    - Viewed (0)
  10. tests/test_tutorial/test_dependencies/test_tutorial008b_an_py39.py

        client = TestClient(app)
        return client
    
    
    @needs_py39
    def test_get_no_item(client: TestClient):
        response = client.get("/items/foo")
        assert response.status_code == 404, response.text
        assert response.json() == {"detail": "Item not found"}
    
    
    @needs_py39
    def test_owner_error(client: TestClient):
        response = client.get("/items/plumbus")
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Sat Feb 24 23:06:37 GMT 2024
    - 918 bytes
    - Viewed (0)
Back to top