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
  f104fef5_a6a9_3a65_eac1_ce569beb7c17["__init__()"]
  0c1f2a3d_8fb3_739d_0a29_b0255469b4ae["WebSocketException"]
  f104fef5_a6a9_3a65_eac1_ce569beb7c17 -->|defined in| 0c1f2a3d_8fb3_739d_0a29_b0255469b4ae
  style f104fef5_a6a9_3a65_eac1_ce569beb7c17 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

fastapi/exceptions.py lines 128–154

    def __init__(
        self,
        code: Annotated[
            int,
            Doc(
                """
                A closing code from the
                [valid codes defined in the specification](https://datatracker.ietf.org/doc/html/rfc6455#section-7.4.1).
                """
            ),
        ],
        reason: Annotated[
            Union[str, None],
            Doc(
                """
                The reason to close the WebSocket connection.

                It is UTF-8-encoded data. The interpretation of the reason is up to the
                application, it is not specified by the WebSocket specification.

                It could contain text that could be human-readable or interpretable
                by the client code, etc.
                """
            ),
        ] = None,
    ) -> None:
        super().__init__(code=code, reason=reason)

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 128.

Analyze Your Own Codebase

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

Try Supermodel Free