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:
ResponseExceptionIndicate the response did not contain valid JSON.
- Parameters:
response (requests.Response)
- Return type:
None
- exception prawcore.exceptions.BadRequest(response)¶
Bases:
ResponseExceptionIndicate invalid parameters for the request.
- Parameters:
response (requests.Response)
- Return type:
None
- exception prawcore.exceptions.Conflict(response)¶
Bases:
ResponseExceptionIndicate a conflicting change in the target resource.
- Parameters:
response (requests.Response)
- Return type:
None
- exception prawcore.exceptions.Forbidden(response)¶
Bases:
ResponseExceptionIndicate the authentication is not permitted for the request.
- Parameters:
response (requests.Response)
- Return type:
None
- exception prawcore.exceptions.InsufficientScope(response)¶
Bases:
ResponseExceptionIndicate that the request requires a different scope.
- Parameters:
response (requests.Response)
- Return type:
None
- exception prawcore.exceptions.InvalidInvocation¶
Bases:
PrawcoreExceptionIndicate that the code to execute cannot be completed.
- exception prawcore.exceptions.InvalidToken(response)¶
Bases:
ResponseExceptionIndicate that the request used an invalid access token.
- Parameters:
response (requests.Response)
- Return type:
None
- exception prawcore.exceptions.NotFound(response)¶
Bases:
ResponseExceptionIndicate that the requested URL was not found.
- Parameters:
response (requests.Response)
- Return type:
None
- exception prawcore.exceptions.OAuthException(response, error, description=None)¶
Bases:
PrawcoreExceptionIndicate that there was an OAuth2 related error with the request.
- Parameters:
response (requests.Response)
error (str)
description (str | None)
- Return type:
None
- exception prawcore.exceptions.PrawcoreException¶
Bases:
ExceptionBase exception class for exceptions that occur within this package.
- exception prawcore.exceptions.Redirect(response)¶
Bases:
ResponseExceptionIndicate 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:
PrawcoreExceptionIndicate that there was an error with the incomplete HTTP request.
- exception prawcore.exceptions.ResponseException(response)¶
Bases:
PrawcoreExceptionIndicate that there was an error with the completed HTTP request.
- Parameters:
response (requests.Response)
- Return type:
None
- exception prawcore.exceptions.ServerError(response)¶
Bases:
ResponseExceptionIndicate issues on the server end preventing request fulfillment.
- Parameters:
response (requests.Response)
- Return type:
None
- exception prawcore.exceptions.SpecialError(response)¶
Bases:
ResponseExceptionIndicate syntax or spam-prevention issues.
- Parameters:
response (requests.Response)
- Return type:
None
- exception prawcore.exceptions.TooLarge(response)¶
Bases:
ResponseExceptionIndicate that the request data exceeds the allowed limit.
- Parameters:
response (requests.Response)
- Return type:
None
- exception prawcore.exceptions.TooManyRequests(response)¶
Bases:
ResponseExceptionIndicate 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:
ResponseExceptionIndicate that the length of the request URI exceeds the allowed limit.
- Parameters:
response (requests.Response)
- Return type:
None
Bases:
ResponseExceptionIndicate that the requested URL is unavailable due to legal reasons.
- Parameters:
response (requests.Response)
- Return type:
None