AccessCode

class q2_sdk.hq.db.access_code.AccessCode(logger, hq_credentials=None, ret_table_obj=None)[source]

Bases: DbObject

DbObject for interacting with User Access Codes (used for Multi Factor Authentication)

Programmatic access to the Q2 database. Not as flexible as a true ORM, but takes the guesswork out of database schemas and ensures safety in the transactions.

Parameters:
  • logger – Reference to calling request’s logger (self.logger in your extension)

  • hq_credentials (Optional[HqCredentials]) – HQ Connectivity Information (Defaults to settings file)

  • ret_table_obj (Optional[bool]) – Flag to return list of LXML elements if False or TableRow objects from DB calls if True (Defaults to settings file)

VALID_TARGET_TYPES = ['Voice', 'Sms', 'Email']
add_arguments(parser)[source]

Hook for subclassed DbObjects to add custom arguments.

async get_targets(logon_name, exclude_email=False, exclude_phone=False, exclude_sms=False, serialize_for_cli=False)[source]

Convenience function for working with Q2Api.GetEndUserAccessCodeTargets HQ Endpoint

Return type:

HqResponse

async create_targets(logon_name, target_address, target_type, target_country_iso_code_a3='USA', serialize_for_cli=False)[source]
Param:

logon_name: The end users login name

Param:

target_address: the value to be used as the target

Param:

target_type: what type of target is this. Valid types: Voice, Sms, Email

Param:

target_country_iso_code_a3: ISO A3 country code if the Sms/Voice number is international

Param:

serialize_for_cli: boolean to control whether the output is displayed to the CLI

Return type:

HqResponse

async delete_targets(user_obj, session_obj, target_id=None, target_address=None, target_type=None)[source]
async delete_accesscode_target(logon_name, ui_source, target_address, target_type, hq_credentials=None)[source]