Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 13 for Sanders (0.22 sec)

  1. tests/test_starlette_exception.py

        assert response.json() == {"detail": "Item not found"}
    
    
    def test_no_body_status_code_exception_handlers():
        response = client.get("/http-no-body-statuscode-exception")
        assert response.status_code == 204
        assert not response.content
    
    
    def test_no_body_status_code_with_detail_exception_handlers():
        response = client.get("/http-no-body-statuscode-with-detail-exception")
        assert response.status_code == 204
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 7.4K bytes
    - Viewed (0)
  2. tests/test_ws_router.py

        """
    
        async def custom_handler(websocket: WebSocket, exc: CustomError) -> None:
            await websocket.close(1002, "foo")
    
        myapp = make_app(exception_handlers={CustomError: custom_handler})
        client = TestClient(myapp)
        with pytest.raises(WebSocketDisconnect) as e:
            with client.websocket_connect("/custom_error/"):
                pass  # pragma: no cover
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sun Jun 11 19:08:14 GMT 2023
    - 7.5K bytes
    - Viewed (0)
  3. fastapi/exception_handlers.py

    Kristján Valur Jónsson <******@****.***> 1686510494 +0000
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sun Jun 11 19:08:14 GMT 2023
    - 1.3K bytes
    - Viewed (0)
  4. docs_src/additional_status_codes/tutorial001_an.py

    from fastapi import Body, FastAPI, status
    from fastapi.responses import JSONResponse
    from typing_extensions import Annotated
    
    app = FastAPI()
    
    items = {"foo": {"name": "Fighters", "size": 6}, "bar": {"name": "Tenders", "size": 3}}
    
    
    @app.put("/items/{item_id}")
    async def upsert_item(
        item_id: str,
        name: Annotated[Union[str, None], Body()] = None,
        size: Annotated[Union[int, None], Body()] = None,
    ):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 734 bytes
    - Viewed (0)
  5. tests/test_exception_handlers.py

    
    def server_error_exception_handler(request, exception):
        return JSONResponse(status_code=500, content={"exception": "server-error"})
    
    
    app = FastAPI(
        exception_handlers={
            HTTPException: http_exception_handler,
            RequestValidationError: request_validation_exception_handler,
            Exception: server_error_exception_handler,
        }
    )
    
    client = TestClient(app)
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Feb 17 12:40:12 GMT 2022
    - 1.9K bytes
    - Viewed (0)
  6. tests/test_tutorial/test_additional_responses/test_tutorial003.py

                                        "example": {
                                            "id": "bar",
                                            "value": "The bar tenders",
                                        },
                                    }
                                },
                            },
                            "422": {
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 4.5K bytes
    - Viewed (0)
  7. docs_src/additional_status_codes/tutorial001.py

    from typing import Union
    
    from fastapi import Body, FastAPI, status
    from fastapi.responses import JSONResponse
    
    app = FastAPI()
    
    items = {"foo": {"name": "Fighters", "size": 6}, "bar": {"name": "Tenders", "size": 3}}
    
    
    @app.put("/items/{item_id}")
    async def upsert_item(
        item_id: str,
        name: Union[str, None] = Body(default=None),
        size: Union[int, None] = Body(default=None),
    ):
        if item_id in items:
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 684 bytes
    - Viewed (0)
  8. docs_src/additional_status_codes/tutorial001_an_py39.py

    from typing import Annotated, Union
    
    from fastapi import Body, FastAPI, status
    from fastapi.responses import JSONResponse
    
    app = FastAPI()
    
    items = {"foo": {"name": "Fighters", "size": 6}, "bar": {"name": "Tenders", "size": 3}}
    
    
    @app.put("/items/{item_id}")
    async def upsert_item(
        item_id: str,
        name: Annotated[Union[str, None], Body()] = None,
        size: Annotated[Union[int, None], Body()] = None,
    ):
        if item_id in items:
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 705 bytes
    - Viewed (0)
  9. fastapi/applications.py

            )
            self.exception_handlers: Dict[
                Any, Callable[[Request, Any], Union[Response, Awaitable[Response]]]
            ] = {} if exception_handlers is None else dict(exception_handlers)
            self.exception_handlers.setdefault(HTTPException, http_exception_handler)
            self.exception_handlers.setdefault(
                RequestValidationError, request_validation_exception_handler
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Apr 02 02:48:51 GMT 2024
    - 172.2K bytes
    - Viewed (0)
  10. docs_src/additional_status_codes/tutorial001_py310.py

    from fastapi import Body, FastAPI, status
    from fastapi.responses import JSONResponse
    
    app = FastAPI()
    
    items = {"foo": {"name": "Fighters", "size": 6}, "bar": {"name": "Tenders", "size": 3}}
    
    
    @app.put("/items/{item_id}")
    async def upsert_item(
        item_id: str,
        name: str | None = Body(default=None),
        size: int | None = Body(default=None),
    ):
        if item_id in items:
            item = items[item_id]
            item["name"] = name
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 646 bytes
    - Viewed (0)
Back to top