The gnocchiclient.exceptions Module

exception gnocchiclient.exceptions.ArchivePolicyAlreadyExists(code=None, message=None, request_id=None, url=None, method=None)

Bases: Conflict

match = re.compile('Archive policy .* already exists')
message = 'Archive policy already exists'
exception gnocchiclient.exceptions.ArchivePolicyNotFound(code=None, message=None, request_id=None, url=None, method=None)

Bases: NotFound

match = re.compile('Archive policy .* does not exist')
message = 'Archive policy not found'
exception gnocchiclient.exceptions.ArchivePolicyRuleAlreadyExists(code=None, message=None, request_id=None, url=None, method=None)

Bases: Conflict

match = re.compile('Archive policy rule .* already exists')
message = 'Archive policy rule already exists'
exception gnocchiclient.exceptions.ArchivePolicyRuleNotFound(code=None, message=None, request_id=None, url=None, method=None)

Bases: NotFound

match = re.compile('Archive policy rule .* does not exist')
message = 'Archive policy rule not found'
exception gnocchiclient.exceptions.BadRequest(code=None, message=None, request_id=None, url=None, method=None)

Bases: ClientException

HTTP 400 - Bad request: you sent some malformed data.

http_status = 400
message = 'Bad request'
exception gnocchiclient.exceptions.ClientException(code=None, message=None, request_id=None, url=None, method=None)

Bases: Exception

The base exception class for all exceptions this library raises.

message = 'Unknown Error'
exception gnocchiclient.exceptions.Conflict(code=None, message=None, request_id=None, url=None, method=None)

Bases: ClientException

HTTP 409 - Conflict.

http_status = 409
message = 'Conflict'
exception gnocchiclient.exceptions.ConnectionFailure(code=None, message=None, request_id=None, url=None, method=None)

Bases: ClientException

Connection failure.

exception gnocchiclient.exceptions.ConnectionTimeout(code=None, message=None, request_id=None, url=None, method=None)

Bases: ClientException

Connection timeout.

exception gnocchiclient.exceptions.Forbidden(code=None, message=None, request_id=None, url=None, method=None)

Bases: ClientException

HTTP 403 - Forbidden.

Your credentials don’t give you access to this resource.

http_status = 403
message = 'Forbidden'
exception gnocchiclient.exceptions.MethodNotAllowed(code=None, message=None, request_id=None, url=None, method=None)

Bases: ClientException

HTTP 405 - Method Not Allowed.

http_status = 405
message = 'Method Not Allowed'
exception gnocchiclient.exceptions.MetricNotFound(code=None, message=None, request_id=None, url=None, method=None)

Bases: NotFound

match = re.compile('Metric .* does not exist')
message = 'Metric not found'
exception gnocchiclient.exceptions.NamedMetricAlreadyExists(code=None, message=None, request_id=None, url=None, method=None)

Bases: Conflict

match = re.compile('Named metric .* already exist')
message = 'Named metric already exists'
exception gnocchiclient.exceptions.NotAcceptable(code=None, message=None, request_id=None, url=None, method=None)

Bases: ClientException

HTTP 406 - Not Acceptable.

http_status = 406
message = 'Not Acceptable'
exception gnocchiclient.exceptions.NotFound(code=None, message=None, request_id=None, url=None, method=None)

Bases: ClientException

HTTP 404 - Not found.

http_status = 404
message = 'Not found'
exception gnocchiclient.exceptions.NotImplemented(code=None, message=None, request_id=None, url=None, method=None)

Bases: ClientException

HTTP 501 - Not Implemented.

The server does not support this operation.

http_status = 501
message = 'Not Implemented'
exception gnocchiclient.exceptions.OverLimit(*args, **kwargs)

Bases: RetryAfterException

HTTP 413 - Over limit.

You’re over the API limits for this time period.

http_status = 413
message = 'Over limit'
exception gnocchiclient.exceptions.RateLimit(*args, **kwargs)

Bases: RetryAfterException

HTTP 429 - Rate limit.

You’ve sent too many requests for this time period.

http_status = 429
message = 'Rate limit'
exception gnocchiclient.exceptions.ResourceAlreadyExists(code=None, message=None, request_id=None, url=None, method=None)

Bases: Conflict

match = re.compile('Resource .* already exists')
message = 'Resource already exists'
exception gnocchiclient.exceptions.ResourceNotFound(code=None, message=None, request_id=None, url=None, method=None)

Bases: NotFound

match = re.compile('Resource .* does not exist')
message = 'Resource not found'
exception gnocchiclient.exceptions.ResourceTypeAlreadyExists(code=None, message=None, request_id=None, url=None, method=None)

Bases: Conflict

match = re.compile('Resource type .* already exists')
message = 'Resource type already exists'
exception gnocchiclient.exceptions.ResourceTypeNotFound(code=None, message=None, request_id=None, url=None, method=None)

Bases: NotFound

match = re.compile('Resource type .* does not exist')
message = 'Resource type not found'
exception gnocchiclient.exceptions.RetryAfterException(*args, **kwargs)

Bases: ClientException

The base exception for ClientExceptions that use Retry-After header.

exception gnocchiclient.exceptions.SSLError(code=None, message=None, request_id=None, url=None, method=None)

Bases: ClientException

SSL connection error.

exception gnocchiclient.exceptions.Unauthorized(code=None, message=None, request_id=None, url=None, method=None)

Bases: ClientException

HTTP 401 - Unauthorized: bad credentials.

http_status = 401
message = 'Unauthorized'
exception gnocchiclient.exceptions.UnknownConnectionError(code=None, message=None, request_id=None, url=None, method=None)

Bases: ClientException

Unknown connection error.

gnocchiclient.exceptions.from_response(response, method=None)

Return an instance of one of the ClientException on an requests response.

Usage:

resp, body = requests.request(...)
if resp.status_code != 200:
    raise from_response(resp)