Errors

exception somerandomapi.errors.BadRequest[source]

Bases: SomeRandomApiException

Bad Request error.

exception somerandomapi.errors.Forbidden[source]

Bases: SomeRandomApiException

Forbidden error.

exception somerandomapi.errors.HTTPException[source]

Bases: SomeRandomApiException

Exception raised when an HTTP request fails.

exception somerandomapi.errors.ImageError[source]

Bases: SomeRandomApiException

Exception raised when an image could not be retrieved.

url

The URL of the image.

Type:

str

status

The status code of the response.

Type:

int

exception somerandomapi.errors.InternalServerError[source]

Bases: SomeRandomApiException

Internal Server Error error.

exception somerandomapi.errors.NotFound[source]

Bases: SomeRandomApiException

Not Found error.

exception somerandomapi.errors.RateLimited[source]

Bases: SomeRandomApiException

Too Many Requests error.

exception somerandomapi.errors.SomeRandomApiException[source]

Bases: Exception

Base exception for all errors raised by this library.

data

The data returned by the API.

Type:

Any

endpoint

The endpoint that was called. Use endpoint.path to get the full path of the endpoint.

Type:

Endpoint

exception somerandomapi.errors.TypingError[source]

Bases: TypeError

Exception raised when a typing error occurs.

This is usually raised in a dataclass when a type is not what it is supposed to be.

cls

The class that the error occurred in.

Type:

BaseModel

attribute

The attribute that the error occurred in. Use attribute.name to get the name of the attribute (argument).

Type:

Attribute