Errors¶
-
exception
restfly.errors.
RestflyException
(msg, **kwargs)[source]¶ Base exception class that sets up logging and handles some basic scaffolding for all other exception classes. This exception should never be directly seen.
-
exception
restfly.errors.
UnexpectedValueError
(msg, **kwargs)[source]¶ An unexpected value error is thrown whenever the value specified for a parameter is outside the bounds of what is expected. For example, if the parameter a is expected to have a value of 1, 2, or 3, and it is instead passed a value of 0, then it is an unexpected value, and this Exception should be thrown by the package.
-
exception
restfly.errors.
RequiredParameterError
(msg, **kwargs)[source]¶ A Required Parameter error is thrown whenever the value specified for a parameter is required to have a value other than None.
-
exception
restfly.errors.
APIError
(resp, **kwargs)[source]¶ The APIError Exception is a generic Exception for handling responses from the API that aren’t whats expected. The APIError Exception itself attempts to provide the developer with enough information around the response to ascertain what went wrong.
-
response
¶ This is the Response object that had caused the Exception to fire.
Type: request.Response
-
-
exception
restfly.errors.
BadRequestError
(resp, **kwargs)[source]¶ The server cannot or will not process the request due to an apparent client error (e.g., malformed request syntax, size too large, invalid request message framing, or deceptive request routing).
-
response
¶ This is the Response object that had caused the Exception to fire.
Type: request.Response
-
Similar to 403 Forbidden, but specifically for use when authentication is required and has failed or has not yet been provided. The response must include a WWW-Authenticate header field containing a challenge applicable to the requested resource. See Basic access authentication and Digest access authentication. 401 semantically means “unauthenticated”, i.e. the user does not have the necessary credentials.
The HTTP response code from the offending response.
Type: int
This is the Response object that had caused the Exception to fire.
Type: request.Response
-
exception
restfly.errors.
ForbiddenError
(resp, **kwargs)[source]¶ The request was valid, but the server is refusing action. The user might not have the necessary permissions for a resource, or may need an account of some sort.
-
response
¶ This is the Response object that had caused the Exception to fire.
Type: request.Response
-
-
exception
restfly.errors.
NotFoundError
(resp, **kwargs)[source]¶ The requested resource could not be found but may be available in the future. Subsequent requests by the client are permissible.
-
response
¶ This is the Response object that had caused the Exception to fire.
Type: request.Response
-
-
exception
restfly.errors.
InvalidMethodError
(resp, **kwargs)[source]¶ A request method is not supported for the requested resource; for example, a GET request on a form that requires data to be presented via POST, or a PUT request on a read-only resource.
-
response
¶ This is the Response object that had caused the Exception to fire.
Type: request.Response
-
-
exception
restfly.errors.
NotAcceptableError
(resp, **kwargs)[source]¶ The requested resource is only capable of generating content not acceptable according to the Accept headers sent in the request.
-
response
¶ This is the Response object that had caused the Exception to fire.
Type: request.Response
-
-
exception
restfly.errors.
ProxyAuthenticationError
(resp, **kwargs)[source]¶ The client must first authenticate itself with the proxy.
-
response
¶ This is the Response object that had caused the Exception to fire.
Type: request.Response
-
-
exception
restfly.errors.
RequestTimeoutError
(resp, **kwargs)[source]¶ The client did not produce a request within the time that the server was prepared to wait. The client MAY repeat the request without modifications at any later time.
-
response
¶ This is the Response object that had caused the Exception to fire.
Type: request.Response
-
-
exception
restfly.errors.
RequestConflictError
(resp, **kwargs)[source]¶ Indicates that the request could not be processed because of conflict in the current state of the resource, such as an edit conflict between multiple simultaneous updates.
-
response
¶ This is the Response object that had caused the Exception to fire.
Type: request.Response
-
-
exception
restfly.errors.
NoLongerExistsError
(resp, **kwargs)[source]¶ Indicates that the resource requested is no longer available and will not be available again. This should be used when a resource has been intentionally removed and the resource should be purged. Upon receiving a 410 status code, the client should not request the resource in the future. Clients such as search engines should remove the resource from their indices. Most use cases do not require clients and search engines to purge the resource, and a “404 Not Found” may be used instead.
-
response
¶ This is the Response object that had caused the Exception to fire.
Type: request.Response
-
-
exception
restfly.errors.
LengthRequiredError
(resp, **kwargs)[source]¶ The request did not specify the length of its content, which is required by the requested resource.
-
response
¶ This is the Response object that had caused the Exception to fire.
Type: request.Response
-
-
exception
restfly.errors.
PreconditionFailedError
(resp, **kwargs)[source]¶ The server does not meet one of the preconditions that the requester put on the request.
-
response
¶ This is the Response object that had caused the Exception to fire.
Type: request.Response
-
-
exception
restfly.errors.
PayloadTooLargeError
(resp, **kwargs)[source]¶ The request is larger than the server is willing or able to process.
-
response
¶ This is the Response object that had caused the Exception to fire.
Type: request.Response
-
-
exception
restfly.errors.
URITooLongError
(resp, **kwargs)[source]¶ The URI provided was too long for the server to process. Often the result of too much data being encoded as a query-string of a GET request, in which case it should be converted to a POST request.
-
response
¶ This is the Response object that had caused the Exception to fire.
Type: request.Response
-
-
exception
restfly.errors.
UnsupportedMediaTypeError
(resp, **kwargs)[source]¶ The request entity has a media type which the server or resource does not support. For example, the client uploads an image as image/svg+xml, but the server requires that images use a different format.
-
response
¶ This is the Response object that had caused the Exception to fire.
Type: request.Response
-
-
exception
restfly.errors.
RangeNotSatisfiableError
(resp, **kwargs)[source]¶ The client has asked for a portion of the file (byte serving), but the server cannot supply that portion. For example, if the client asked for a part of the file that lies beyond the end of the file.
-
response
¶ This is the Response object that had caused the Exception to fire.
Type: request.Response
-
-
exception
restfly.errors.
ExpectationFailedError
(resp, **kwargs)[source]¶ The server cannot meet the requirements of the Expect request-header field.
-
response
¶ This is the Response object that had caused the Exception to fire.
Type: request.Response
-
-
exception
restfly.errors.
TeapotResponseError
(resp, **kwargs)[source]¶ This code was defined in 1998 as one of the traditional IETF April Fools’ jokes, in RFC 2324, Hyper Text Coffee Pot Control Protocol, and is not expected to be implemented by actual HTTP servers. The RFC specifies this code should be returned by teapots requested to brew coffee.
-
response
¶ This is the Response object that had caused the Exception to fire.
Type: request.Response
-
-
exception
restfly.errors.
MisdirectRequestError
(resp, **kwargs)[source]¶ The request was directed at a server that is not able to produce a response
-
response
¶ This is the Response object that had caused the Exception to fire.
Type: request.Response
-
-
exception
restfly.errors.
TooEarlyError
(resp, **kwargs)[source]¶ Indicates that the server is unwilling to risk processing a request that might be replayed.
-
response
¶ This is the Response object that had caused the Exception to fire.
Type: request.Response
-
-
exception
restfly.errors.
UpgradeRequiredError
(resp, **kwargs)[source]¶ The client should switch to a different protocol such as TLS/1.0, given in the Upgrade header field.
-
response
¶ This is the Response object that had caused the Exception to fire.
Type: request.Response
-
-
exception
restfly.errors.
PreconditionRequiredError
(resp, **kwargs)[source]¶ The origin server requires the request to be conditional. Intended to prevent the ‘lost update’ problem, where a client GETs a resource’s state, modifies it, and PUTs it back to the server, when meanwhile a third party has modified the state on the server, leading to a conflict.
-
response
¶ This is the Response object that had caused the Exception to fire.
Type: request.Response
-
-
exception
restfly.errors.
TooManyRequestsError
(resp, **kwargs)[source]¶ The user has sent too many requests in a given amount of time. Intended for use with rate-limiting schemes.
-
response
¶ This is the Response object that had caused the Exception to fire.
Type: request.Response
-
-
exception
restfly.errors.
RequestHeaderFieldsTooLargeError
(resp, **kwargs)[source]¶ The server is unwilling to process the request because either an individual header field, or all the header fields collectively, are too large.
-
response
¶ This is the Response object that had caused the Exception to fire.
Type: request.Response
-
A server operator has received a legal demand to deny access to a resource or to a set of resources that includes the requested resource.
The HTTP response code from the offending response.
Type: int
This is the Response object that had caused the Exception to fire.
Type: request.Response
-
exception
restfly.errors.
ServerError
(resp, **kwargs)[source]¶ A generic error message, given when an unexpected condition was encountered and no more specific message is suitable.
-
response
¶ This is the Response object that had caused the Exception to fire.
Type: request.Response
-
-
exception
restfly.errors.
MethodNotImplementedError
(resp, **kwargs)[source]¶ The server either does not recognize the request method, or it lacks the ability to fulfil the request. Usually this implies future availability.
-
response
¶ This is the Response object that had caused the Exception to fire.
Type: request.Response
-
-
exception
restfly.errors.
BadGatewayError
(resp, **kwargs)[source]¶ The server was acting as a gateway or proxy and received an invalid response from the upstream server.
-
response
¶ This is the Response object that had caused the Exception to fire.
Type: request.Response
-
The server cannot handle the request (because it is overloaded or down for maintenance). Generally, this is a temporary state.
The HTTP response code from the offending response.
Type: int
This is the Response object that had caused the Exception to fire.
Type: request.Response
-
exception
restfly.errors.
GatewayTimeoutError
(resp, **kwargs)[source]¶ The server was acting as a gateway or proxy and did not receive a timely response from the upstream server.
-
response
¶ This is the Response object that had caused the Exception to fire.
Type: request.Response
-
-
exception
restfly.errors.
NotExtendedError
(resp, **kwargs)[source]¶ Further extensions to the request are required for the server to fulfil it.
-
response
¶ This is the Response object that had caused the Exception to fire.
Type: request.Response
-
-
exception
restfly.errors.
NetworkAuthenticationRequiredError
(resp, **kwargs)[source]¶ The client needs to authenticate to gain network access. Intended for use by intercepting proxies used to control access to the network
-
response
¶ This is the Response object that had caused the Exception to fire.
Type: request.Response
-