Home / Function/ __init__() — fastapi Function Reference

__init__() — fastapi Function Reference

Architecture documentation for the __init__() function in exceptions.py from the fastapi codebase.

Entity Profile

Dependency Diagram

graph TD
  f6872f86_1345_04a3_eed4_2f571bd8af4d["__init__()"]
  53e07af2_3e5c_ea1f_ee6c_abc9792bf48b["HTTPException"]
  f6872f86_1345_04a3_eed4_2f571bd8af4d -->|defined in| 53e07af2_3e5c_ea1f_ee6c_abc9792bf48b
  style f6872f86_1345_04a3_eed4_2f571bd8af4d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

fastapi/exceptions.py lines 45–83

    def __init__(
        self,
        status_code: Annotated[
            int,
            Doc(
                """
                HTTP status code to send to the client.

                Read more about it in the
                [FastAPI docs for Handling Errors](https://fastapi.tiangolo.com/tutorial/handling-errors/#use-httpexception)
                """
            ),
        ],
        detail: Annotated[
            Any,
            Doc(
                """
                Any data to be sent to the client in the `detail` key of the JSON
                response.

                Read more about it in the
                [FastAPI docs for Handling Errors](https://fastapi.tiangolo.com/tutorial/handling-errors/#use-httpexception)
                """
            ),
        ] = None,
        headers: Annotated[
            Optional[Mapping[str, str]],
            Doc(
                """
                Any headers to send to the client in the response.

                Read more about it in the
                [FastAPI docs for Handling Errors](https://fastapi.tiangolo.com/tutorial/handling-errors/#add-custom-headers)

                """
            ),
        ] = None,
    ) -> None:
        super().__init__(status_code=status_code, detail=detail, headers=headers)

Domain

Subdomains

Frequently Asked Questions

What does __init__() do?
__init__() is a function in the fastapi codebase, defined in fastapi/exceptions.py.
Where is __init__() defined?
__init__() is defined in fastapi/exceptions.py at line 45.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free