novaclient.exceptions module

异常定义。

exception novaclient.exceptions.BadRequest(code, message=None, details=None, request_id=None, url=None, method=None)

基础: ClientException

HTTP 400 - 请求错误:您发送了格式错误的数据。

http_status = 400
message = '错误的请求'
exception novaclient.exceptions.ClientException(code, message=None, details=None, request_id=None, url=None, method=None)

基础: Exception

此库引发的所有异常的基类。

message = '未知错误'
exception novaclient.exceptions.CommandError

基础: Exception

exception novaclient.exceptions.Conflict(code, message=None, details=None, request_id=None, url=None, method=None)

基础: ClientException

HTTP 409 - 冲突

http_status = 409
message = '冲突'
exception novaclient.exceptions.Forbidden(code, message=None, details=None, request_id=None, url=None, method=None)

基础: ClientException

HTTP 403 - 禁止访问:您的凭据没有访问此资源的权限。

http_status = 403
message = '禁止访问'
exception novaclient.exceptions.HTTPNotImplemented(code, message=None, details=None, request_id=None, url=None, method=None)

基础: ClientException

HTTP 501 - 未实现:服务器不支持此操作。

http_status = 501
message = '未实现'
exception novaclient.exceptions.InstanceInDeletedState

基础: Exception

实例处于已删除状态。

exception novaclient.exceptions.InvalidUsage

基础: RuntimeError

这种函数调用在你使用这个客户端的方式中是无效的。

由于过渡到使用 keystoneauth,一些函数调用不再可用。您应该对会话对象进行类似的调用。

exception novaclient.exceptions.MethodNotAllowed(code, message=None, details=None, request_id=None, url=None, method=None)

基础: ClientException

HTTP 405 - 方法不允许

http_status = 405
message = '方法不允许'
exception novaclient.exceptions.NoUniqueMatch

基础: Exception

exception novaclient.exceptions.NotAcceptable(code, message=None, details=None, request_id=None, url=None, method=None)

基础: ClientException

HTTP 406 - 不接受

http_status = 406
message = '不接受'
exception novaclient.exceptions.NotFound(code, message=None, details=None, request_id=None, url=None, method=None)

基础: ClientException

HTTP 404 - 未找到

http_status = 404
message = '未找到'
exception novaclient.exceptions.OverLimit(*args, **kwargs)

基础: RetryAfterException

HTTP 413 - 超出限制:您在此时间段内超过了 API 限制。

http_status = 413
message = '超出限制'
exception novaclient.exceptions.RateLimit(*args, **kwargs)

基础: RetryAfterException

HTTP 429 - 速率限制:您在此时间段内发送了过多的请求。

http_status = 429
message = '速率限制'
exception novaclient.exceptions.ResourceInErrorState(obj)

基础: Exception

资源处于错误状态。

异常 novaclient.exceptions.ResourceNotFound

基础: Exception

获取资源时出错。

异常 novaclient.exceptions.RetryAfterException(*args, **kwargs)

基础: ClientException

使用 Retry-After 头部进行客户端异常的基础异常类。

异常 novaclient.exceptions.Unauthorized(code, message=None, details=None, request_id=None, url=None, method=None)

基础: ClientException

HTTP 401 - 未授权:无效凭据。

http_status = 401
message = '未授权'
异常 novaclient.exceptions.UnsupportedAttribute(argument_name, start_version, end_version=None)

基础: AttributeError

指示用户正在尝试将参数传递给方法,而该方法不受所选版本支持。

异常 novaclient.exceptions.UnsupportedConsoleType(console_type)

基础: Exception

指示用户正在尝试在检索服务器控制台 URL 时使用不受支持的控制台类型。

异常 novaclient.exceptions.UnsupportedVersion

基础: Exception

指示用户正在尝试使用 API 的不受支持的版本。

异常 novaclient.exceptions.VersionNotFoundForAPIMethod(version, method)

基础: Exception

msg_fmt = "API 版本 '%(vers)s' '%(method)s' 方法上不受支持。"
novaclient.exceptions.from_response(response, body, url, method=None)

根据请求响应返回 ClientException 或子类的实例。

用法

resp, body = requests.request(...)
if resp.status_code != 200:
    raise exception_from_response(resp, rest.text)