HqCredentials

class q2_sdk.hq.models.hq_credentials.HqCredentials(hq_url, csr_user, csr_pwd, aba, auth_token=None, reported_hq_url=None, customer_key=None, database_name=None, db_schema_name=None, env_stack=None, db_server_name=None)[source]

Holds information for connecting to an HQ instance

static split_hq_url_list(hq_url_raw)[source]

Turns a raw comma delimited HQ URL string into a list of formatted HQ URLs

Return type:

list

rotate_hq_url()[source]

If there is a list of HQ_URLs in settings, switch active to the next one

get_backoffice_credentials(logger, user_name, password, auto_logoff=True)[source]

Returns a BackOfficeHqCredentials object usable with Q2API.BackOffice endpoints :type logger: TypeAliasType :param logger: Reference to calling request’s logger (self.logger in your extension) :type user_name: str :param user_name: Central Username :type password: str :param password: Central Password :type auto_logoff: :param auto_logoff: If True, session will end after the first network call

class q2_sdk.hq.models.hq_credentials.BackOfficeHqCredentials(logger, hq_credentials, user_name=None, password=None, auto_logoff=True, session_token=None)[source]

BackOffice endpoints require an CsrUser that is allowed Central access.

The user typically provided in self.hq_credentials for a RequestHandler does not have this ability, so it is often necessary to pass a new user_name/password combination obtained by another means.

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

  • hq_credentials (HqCredentials) – HQ Connectivity Information

  • user_name (str | None) – Central Username

  • password (str | None) – Central Password

  • auto_logoff – If True, session will end after the first network call

  • session_token – If a backoffice session already exists, populate it here

get_backoffice_credentials(logger, user_name, password, auto_logoff=True)[source]

This function will error when called on BackOfficeHqCredentials