redditwarp.exceptions#

exception redditwarp.exceptions.ArgExcMixin(arg: object = None)[source]#

Bases: Exception

Mixin exception class where the arg argument is used as the exception message.

get_default_message() str[source]#

Get a default message for this exception type.

exception redditwarp.exceptions.ArgExc(arg: object = None)[source]#

Bases: ArgExcMixin

exception redditwarp.exceptions.OperationException(arg: object = None)[source]#

Bases: ArgExc

A class of exceptions for when the client needs to raise an artificial exception.

exception redditwarp.exceptions.NoResultException(arg: object = None)[source]#

Bases: OperationException

Raised when a requested target does not exist.

exception redditwarp.exceptions.RejectedResultException(arg: object = None)[source]#

Bases: OperationException

Raised when a returned value does not fulfil some invariant.

exception redditwarp.exceptions.UnexpectedResultException(arg: object = None)[source]#

Bases: OperationException

Raised when a certain result was not expected.

exception redditwarp.exceptions.Throwaway(arg: object = None)[source]#

Bases: ArgExc

These exceptions are not intended to be caught.

exception redditwarp.exceptions.UserAgentRequired(arg: object = None)[source]#

Bases: Throwaway

Raised when the client detects that the Reddit API wants you to set a user agent.

redditwarp.exceptions.raise_for_non_json_response(resp: Response) None[source]#

Raise exceptions for a HTTP response from Reddit that does not contain JSON.

This function assumes the given response object does not contain JSON.

exception redditwarp.exceptions.APIError(arg: object = None)[source]#

Bases: OperationException

A formal API error.

exception redditwarp.exceptions.RedditError(arg: object = None, *, label: str, explanation: str, field: str)[source]#

Bases: APIError

A Reddit error.

Errors from Reddit’s API typically consist of three pieces of information: an error label, an explanation, and the name of a related parameter field.

label: str#

A label for the error. E.g., USER_REQUIRED, INVALID_OPTION, SUBREDDIT_NOEXIST. In rare cases this label may not always be in uppercase. It can even contain spaces.

explanation: str#

A description for the error.

field: str#

The name of the parameter relevant to the error, if applicable.

get_default_message() str[source]#

Get a default message for this exception type.

redditwarp.exceptions.VanillaProviderAPIError#

alias of RedditError

redditwarp.exceptions.raise_for_reddit_error(json_data: Any) None[source]#

Examine JSON data returned from the API and raise exceptions if any API errors were detected.

This function is the default snub parameter value for the Client.request method.