Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/openstatusHQ/sdk-python. Official Python SDK for openstatus
Something went wrong. Try again.
1.7 kB · 61 lines
Python
at main
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162from __future__ import annotations
from collections.abc import Sequence
__all__ = [ "AuthenticationError", "InvalidArgumentError", "JsonValue", "NotFoundError", "OpenstatusError", "PermissionDeniedError", "RateLimitError", "ServiceUnavailableError",]
JsonScalar = str | int | float | bool | NoneJsonValue = JsonScalar | list["JsonValue"] | dict[str, "JsonValue"]
class OpenstatusError(Exception): """Base class for all Openstatus SDK errors raised by the HTTP transport."""
def __init__( self, message: str, *, connect_code: str = "unknown", http_status: int = 0, details: Sequence[JsonValue] = (), raw_body: str = "", ) -> None: super().__init__(message) self.connect_code: str = connect_code self.http_status: int = http_status self.details: list[JsonValue] = list(details) self.raw_body: str = raw_body
class AuthenticationError(OpenstatusError): """Raised when the API rejects the supplied credentials (`unauthenticated`)."""
class NotFoundError(OpenstatusError): """Raised when the API cannot locate the requested resource (`not_found`)."""
class InvalidArgumentError(OpenstatusError): """Raised when the request payload is malformed (`invalid_argument`)."""
class PermissionDeniedError(OpenstatusError): """Raised when the caller is not allowed to perform the action (`permission_denied`)."""
class RateLimitError(OpenstatusError): """Raised when the caller has exceeded a quota (`resource_exhausted`)."""
class ServiceUnavailableError(OpenstatusError): """Raised when the service is temporarily unreachable or returns a non-RPC body."""