api_24sea.exceptions#

Custom exceptions for the 24SEA API.

Exceptions#

AuthenticationError

An exception to raise when the user is not authenticated.

ProfileError

An exception to raise when the user is authenticated, but its profile

DataSignalsError

An exception to raise when the data signals are not properly

HTTPError

Base class for RequestError and HTTPStatusError.

Functions#

raise_for_status(→ None)

Raise an HTTPError if the response status code indicates an error.

Module Contents#

exception AuthenticationError#

An exception to raise when the user is not authenticated.

exception ProfileError#

An exception to raise when the user is authenticated, but its profile is not properly configured.

exception DataSignalsError#

An exception to raise when the data signals are not properly configured.

exception HTTPError(message: str, text: str = '')#

Base class for RequestError and HTTPStatusError.

Useful for try...except blocks when issuing a request, and then calling .raise_for_status().

For example:

>>> try:
...     response = httpx.get("https://www.example.com")
...     response.raise_for_status()
... except httpx.HTTPError as exc:
...     print(f"HTTP Exception for {exc.request.url} - {exc}")
raise_for_status(response) None#

Raise an HTTPError if the response status code indicates an error.

This function checks the status code of the provided HTTP response. If the status code is in the 4xx or 5xx range, it raises an HTTPError with a descriptive message including the status code and URL.

Parameters#

responsehttpx.Response

The HTTP response object to check for errors.

Raises#

HTTPError

If the response status code is between 400 and 599 (inclusive), indicating a client or server error.