APIException class - Platform - BlueCat Gateway - 18.6.1

Gateway Administration Guide

BlueCat Gateway

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

from bluecat import api, api_exception

    conn = API('')
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 further details about the exception (may be None).


Get a message describing the exception.


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

Bases: api_exception.RESTException

An error representing Invalid username or password.

code = 401
name = 'Unauthourized'


exceptionapi_exception.BAMException(message, details=None)

Bases: api_exception.APIException

A class representing exceptions raised by BAM.


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'


exceptionapi_exception.PortalException(message, details=None)

Bases: exceptions.Exception

Base class for AuthenticationError and ConnectionError exceptions

code = 400

Return the byte string representation of obj