Exceptions

All exceptions raised by prawcore subclass PrawcoreException, so catching it is sufficient to handle any error originating from prawcore.

Provide exception classes for the prawcore package.

exception prawcore.exceptions.BadJSON(response)

Bases: ResponseException

Indicate the response did not contain valid JSON.

Parameters:

response (requests.Response)

Return type:

None

exception prawcore.exceptions.BadRequest(response)

Bases: ResponseException

Indicate invalid parameters for the request.

Parameters:

response (requests.Response)

Return type:

None

exception prawcore.exceptions.Conflict(response)

Bases: ResponseException

Indicate a conflicting change in the target resource.

Parameters:

response (requests.Response)

Return type:

None

exception prawcore.exceptions.Forbidden(response)

Bases: ResponseException

Indicate the authentication is not permitted for the request.

Parameters:

response (requests.Response)

Return type:

None

exception prawcore.exceptions.InsufficientScope(response)

Bases: ResponseException

Indicate that the request requires a different scope.

Parameters:

response (requests.Response)

Return type:

None

exception prawcore.exceptions.InvalidInvocation

Bases: PrawcoreException

Indicate that the code to execute cannot be completed.

exception prawcore.exceptions.InvalidToken(response)

Bases: ResponseException

Indicate that the request used an invalid access token.

Parameters:

response (requests.Response)

Return type:

None

exception prawcore.exceptions.NotFound(response)

Bases: ResponseException

Indicate that the requested URL was not found.

Parameters:

response (requests.Response)

Return type:

None

exception prawcore.exceptions.OAuthException(response, error, description=None)

Bases: PrawcoreException

Indicate that there was an OAuth2 related error with the request.

Parameters:
Return type:

None

exception prawcore.exceptions.PrawcoreException

Bases: Exception

Base exception class for exceptions that occur within this package.

exception prawcore.exceptions.Redirect(response)

Bases: ResponseException

Indicate the request resulted in a redirect.

This class adds the attribute path, which is the path to which the response redirects.

Parameters:

response (requests.Response)

Return type:

None

exception prawcore.exceptions.RequestException(original_exception, request_args, request_kwargs)

Bases: PrawcoreException

Indicate that there was an error with the incomplete HTTP request.

Parameters:
Return type:

None

exception prawcore.exceptions.ResponseException(response)

Bases: PrawcoreException

Indicate that there was an error with the completed HTTP request.

Parameters:

response (requests.Response)

Return type:

None

exception prawcore.exceptions.ServerError(response)

Bases: ResponseException

Indicate issues on the server end preventing request fulfillment.

Parameters:

response (requests.Response)

Return type:

None

exception prawcore.exceptions.SpecialError(response)

Bases: ResponseException

Indicate syntax or spam-prevention issues.

Parameters:

response (requests.Response)

Return type:

None

exception prawcore.exceptions.TooLarge(response)

Bases: ResponseException

Indicate that the request data exceeds the allowed limit.

Parameters:

response (requests.Response)

Return type:

None

exception prawcore.exceptions.TooManyRequests(response)

Bases: ResponseException

Indicate that the user has sent too many requests in a given amount of time.

Parameters:

response (requests.Response)

Return type:

None

exception prawcore.exceptions.URITooLong(response)

Bases: ResponseException

Indicate that the length of the request URI exceeds the allowed limit.

Parameters:

response (requests.Response)

Return type:

None

exception prawcore.exceptions.UnavailableForLegalReasons(response)

Bases: ResponseException

Indicate that the requested URL is unavailable due to legal reasons.

Parameters:

response (requests.Response)

Return type:

None