Exceptions

The following exceptions are thrown by the library.

TopGGException

exception topgg.TopGGException[source]

Bases: Exception

Base exception class for topggpy.

Ideally speaking, this could be caught to handle any exceptions thrown from this library.

UnauthorizedDetected

exception topgg.UnauthorizedDetected[source]

Bases: topgg.errors.TopGGException

Exception that’s thrown when no API Token is provided.

ClientException

exception topgg.ClientException[source]

Bases: topgg.errors.TopGGException

Exception that’s thrown when an operation in the DBLClient fails.

These are usually for exceptions that happened due to user input.

HTTPException

exception topgg.HTTPException(response: ClientResponse, message: Union[dict, str])[source]

Bases: topgg.errors.TopGGException

Exception that’s thrown when an HTTP request operation fails.

response

The response of the failed HTTP request.

Type

aiohttp.ClientResponse

text

The text of the error. Could be an empty string.

Type

str

Unauthorized

exception topgg.Unauthorized(response: ClientResponse, message: Union[dict, str])[source]

Bases: topgg.errors.HTTPException

Exception that’s thrown when status code 401 occurs.

Forbidden

exception topgg.Forbidden(response: ClientResponse, message: Union[dict, str])[source]

Bases: topgg.errors.HTTPException

Exception that’s thrown when status code 403 occurs.

NotFound

exception topgg.NotFound(response: ClientResponse, message: Union[dict, str])[source]

Bases: topgg.errors.HTTPException

Exception that’s thrown when status code 404 occurs.

ServerError

exception topgg.ServerError(response: ClientResponse, message: Union[dict, str])[source]

Bases: topgg.errors.HTTPException

Exception that’s thrown when Top.gg returns “Server Error” responses (status codes such as 500 and 503).