APIException class - Platform - BlueCat Gateway - 18.6.1

Gateway Administration Guide

prodname
BlueCat Gateway
version_custom
18.6.1

APIExceptions are thrown by the various classes in the BAM API in response to detectable error conditions.

#!/usr/bin/python
from bluecat import api, api_exception

try:
    conn = API('http://192.168.56.191/Services/API?wsdl')
except APIException as e:
    # Something went wrong.
    print e.get_message(), e.get_details()

A class representing API exceptions. Most of these are things returned by the BAM SOAP API but other errors (such as failure to SSH to a server and a non-zero exit from nsupdate) can also result in exceptions being raised.

API Exception wrapper

exceptionapi_exception.APIException(message, details=None)

Bases: exceptions.Exception

Create a new instance with a message and optional details. The content of these fields is not intended to be interpreted by software, but to appear near the top of a program to be easily seen and consumed by the user.

Parameter Description
message Primary string describing why the exception was raised.
details Details, where available, of the specific exception.
get_details()

Get further details about the exception (may be None).

get_message()

Get a message describing the exception.

AuthenticationError

exceptionapi_exception.AuthenticationError(message, status_code=None, payload=None)

Bases: api_exception.RESTException

An error representing Invalid username or password.

code = 401
name = 'Unauthourized'

BAMException

exceptionapi_exception.BAMException(message, details=None)

Bases: api_exception.APIException

A class representing exceptions raised by BAM.

ConnectionError

exceptionapi_exception.ConnectionError(message, status_code=None, payload=None)

Bases: api_exception.RESTException

An error representing a Portal connection error which is not authentication.

code = 404
name = 'Not Found'

PortalException

exceptionapi_exception.PortalException(message, details=None)

Bases: exceptions.Exception

Base class for AuthenticationError and ConnectionError exceptions

code = 400
to_dict()

Return the byte string representation of obj