hexonet.apiconnector package

hexonet.apiconnector

A connector library for the insanely fast HEXONET Backend API. :copyright: © 2018 by HEXONET GmbH. :license: MIT, see LICENSE for more details.

Submodules

hexonet.apiconnector.apiclient

This module covers all necessary functionality for http communicatiton with our Backend System. :copyright: © 2018 by HEXONET GmbH. :license: MIT, see LICENSE for more details.

class hexonet.apiconnector.apiclient.APIClient

Bases: object

disableDebugMode()

Disable Debug Output

enableDebugMode()

Enable Debug Output to STDOUT

getPOSTData(cmd, secured=False)

Serialize given command for POST request including connection configuration data

getProxy()

Get Proxy configuration value for API communication

getReferer()

Get the Referer Header configuration value

getSession()

Get the API Session that is currently set

getURL()

Get the API connection url that is currently set

getUserAgent()

Get the User Agent

getVersion()

Get the current module version

login(otp='')

Perform API login to start session-based communication

loginExtended(params, otp='')

Perform API login to start session-based communication. Use given specific command parameters.

logout()

Perform API logout to close API session in use

request(cmd)

Perform API request using the given command

requestAllResponsePages(cmd)

Request all pages/entries for the given query command

requestNextResponsePage(rr)

Request the next page of list entries for the current list query Useful for tables

resetUserView()

Reset data view back from subuser to user

reuseSession(session)

Use existing configuration out of session to rebuild and reuse connection settings

saveSession(session)

Apply session data (session id and system entity) to given client request session

setCredentials(uid, pw)

Set Credentials to be used for API communication

setCustomLogger(logger)

Set custom logger to use instead of the default one

setDefaultLogger()

Set default logger to use

setOTP(value)

Set one time password to be used for API communication

setProxy(proxy)

Set Proxy to use for API communication

setReferer(referer)

Set the Referer Header to use for API communication

setRemoteIPAddress(value)

Set an Remote IP Address to be used for API communication. To be used in case you have an active ip filter setting.

setRoleCredentials(uid, role, pw)

Set Credentials to be used for API communication

setSession(value)

Set an API session id to be used for API communication

setURL(value)

Set another connection url to be used for API communication

setUserAgent(pid, rv, modules=[])

Possibility to customize default user agent to fit your needs by given string and revision

setUserView(uid)

Set a data view to a given subuser

useDefaultConnectionSetup()

Activate Default Connection Setup (which is the default anyways)

useHighPerformanceConnectionSetup()

Activate High Performance Setup

useLIVESystem()

Set LIVE System for API communication (this is the default setting)

useOTESystem()

Set OT&E System for API communication

hexonet.apiconnector.column

This module covers all necessary functionality to work with a column and wrapped data. :copyright: © 2018 by HEXONET GmbH. :license: MIT, see LICENSE for more details.

class hexonet.apiconnector.column.Column(key, data)

Bases: object

The Column class covers all you need to access column data of a Backend API response.

getData()

Get column data

getDataByIndex(idx)

Get column data at given index

getKey()

Get column name

hasDataIndex(idx)

Check if column has a given data index

hexonet.apiconnector.customlogger

This module provides all necessary functionality for debug outputs :copyright: © 2020 by HEXONET GmbH. :license: MIT, see LICENSE for more details.

class hexonet.apiconnector.customlogger.CustomLogger

Bases: Logger, object

The Logger class covers all you need to cover debug outputs of the API communication.

log(post, r, error)

output/log given data

hexonet.apiconnector.logger

This module provides all necessary functionality for debug outputs see the customlogger class on how to override this :copyright: © 2018 by HEXONET GmbH. :license: MIT, see LICENSE for more details.

class hexonet.apiconnector.logger.Logger

Bases: object

The Logger class covers all you need to cover debug outputs of the API communication.

log(post, r, error)

output/log given data

hexonet.apiconnector.record

This module covers all necessary functionality to work with a record and wrapped data. :copyright: © 2018 by HEXONET GmbH. :license: MIT, see LICENSE for more details.

class hexonet.apiconnector.record.Record(data)

Bases: object

The Record class covers all you need to access record data of a Backend API response.

getData()

get row data

getDataByKey(key)

get row data for given column name

hexonet.apiconnector.response

This module covers all necessary functionality to work with Backend API responses. :copyright: © 2018 by HEXONET GmbH. :license: MIT, see LICENSE for more details.

class hexonet.apiconnector.response.Response(raw, cmd=None, cfg={})

Bases: ResponseTemplate, object

The Response class covers all necessary functionality to cover access to Backend API response data in a useful way.

addColumn(key, data)

Add a column to the column list

addRecord(h)

Add a record to the record list

getColumn(key)

Get column by column name

getColumnIndex(colkey, index)

Get Data by Column Name and Index

getColumnKeys()

Get Column Names

getColumns()

Get List of Columns

getCommand()

Get Command used in this request

getCommandPlain()

Get Command used in this request in plain text

getCurrentPageNumber()

Get Page Number of current List Query

getCurrentRecord()

Get Record of current record index

getFirstRecordIndex()

Get Index of first row in this response

getLastRecordIndex()

Get last record index of the current list query

getListHash()

Get Response as List Hash including useful meta data for tables

getNextPageNumber()

Get Page Number of next list query

getNextRecord()

Get next record in record list

getNumberOfPages()

Get the number of pages available for this list query

getPagination()

Get object containing all paging data

getPreviousPageNumber()

Get Page Number of previous list query

getPreviousRecord()

Get previous record in record list

getRecord(idx)

Get Record at given index

getRecords()

Get all Records

getRecordsCount()

Get count of rows in this response

getRecordsLimitation()

Get limit(ation) setting of the current list query

getRecordsTotalCount()

Get total count of records available for the list query

hasNextPage()

Check if this list query has a next page

hasPreviousPage()

Check if this list query has a previous page

rewindRecordList()

Reset index in record list back to zero

hexonet.apiconnector.responseparser

This module covers all necessary functionality to parse a raw Backend API response and to serialize it back. :copyright: © 2018 by HEXONET GmbH. :license: MIT, see LICENSE for more details.

hexonet.apiconnector.responseparser.parse(raw)

Returns the response as a string

hexonet.apiconnector.responseparser.serialize(r)

Returns the dictionary represenation serialized back to plain text

hexonet.apiconnector.responsetemplate

This module covers all basic functionality to deal with Backend API responses. :copyright: © 2018 by HEXONET GmbH. :license: MIT, see LICENSE for more details.

class hexonet.apiconnector.responsetemplate.ResponseTemplate(response='')

Bases: object

The ResponseTemplate class is the base class for the Response Class that covers basic functionality to work with Backend API responses.

getCode()

Returns the API response code as integer

getDescription()

Returns the API response description

getHash()

Get API response as Hash

getPlain()

Returns the plain API response

getQueuetime()

Get Queuetime of API response as float value

getRuntime()

Get Runtime of API response as float value

isError()

Check if current API response represents an error case (5xx)

isPending()

Check if current operation is returned as pending

isSuccess()

Check if current API response represents a success case (2xx)

isTmpError()

Check if current API response represents a temporary error case (4xx)

hexonet.apiconnector.responsetemplatemanager

This module covers all functionality to manage response templates. :copyright: © 2018 by HEXONET GmbH. :license: MIT, see LICENSE for more details.

class hexonet.apiconnector.responsetemplatemanager.ResponseTemplateManager

Bases: object

The ResponseTemplateManager class covers all functionality required to manage Response Templates.

addTemplate(id, plain)

Add response template to template container

generateTemplate(code, description)

Returns a response template string for the given code and description

static getInstance()

Returns the singleton instance

getTemplate(id)

Get response template instance from template container

getTemplates()

Return all available response templates

hasTemplate(id)

Check if given template exists in template container

isTemplateMatchHash(tpl2, id)

Check if given API response hash matches a given template by code and description

isTemplateMatchPlain(plain, id)

Check if given API plain response matches a given template by code and description

hexonet.apiconnector.socketconfig

This module covers all necessary functionality to pre-configure http communication with our Backend System. :copyright: © 2018 by HEXONET GmbH. :license: MIT, see LICENSE for more details.

class hexonet.apiconnector.socketconfig.SocketConfig

Bases: object

The SocketConfig class helps to configure the http communcation with our Backend System.

getPOSTData()

Create POST data string out of connection data

getSession()

Get API Session ID in use

getSystemEntity()

Get API System Entity in use

setLogin(value)

Set account name to use

setOTP(value)

Set one time password to use

setPassword(value)

Set account password to use

setRemoteAddress(value)

Set Remote IP Address to use

setSession(value)

Set API Session ID to use

setSystemEntity(value)

Set API System Entity to use. This is set to 54cd / LIVE System by default.

setUser(value)

Set subuser account name (for subuser data view)