xq.api.subscription package
Submodules
xq.api.subscription.authentication module
- xq.api.subscription.authentication.code_validate(api, pin: int)
validate the provided 2FA pin https://xq.stoplight.io/docs/xqmsg/b3A6NDA5MjQ1MjM-validate-access-request-with-a-pin
- Parameters:
api (XQAPI) – XQAPI instance
pin (int) – 2FA code
- Raises:
XQException – invalid pin
- Returns:
isvalid? boolean response
- Return type:
bool
- xq.api.subscription.authentication.exchange_key(api, business_id: str | None = None)
exchange pre-auth token for an access token, and update headers accordingly https://xq.stoplight.io/docs/xqmsg/b3A6NDA5Mzc1NjA-exchange-for-access-token
- Parameters:
api (XQAPI) – XQAPI instance
- Raises:
XQException – key exchange failure
- Returns:
success? boolean
- Return type:
bool
- xq.api.subscription.authentication.validate_api_key(api)
static method for validating provided API keys https://xq.stoplight.io/docs/xqmsg/b3A6NDExNDU1MDg-check-if-valid-api-key
- Parameters:
api (XQAPI) – XQAPI instance
- Raises:
SDKConfigurationException – exception for invalid keys
SDKConfigurationException – exception for http errors
- Returns:
api response
- Return type:
str OR json
xq.api.subscription.key_management module
- xq.api.subscription.key_management.create_and_store_packet(api, recipients: list, expires_hours: int = 24, key: bytes | None = None, type: int = 2, subject: str | None = None)
creates an encrypted packet from a secret key https://xq.stoplight.io/docs/xqmsg/1f9bc1713a7cd-create-and-save-a-new-key-packet
- Parameters:
api (XQAPI) – XQAPI instance
recipients (list) – list of emails to grant access to
expires_hours (int, optional) – packet validation time in hours, defaults to 24
key (bytes, optional) – secret key to encrypt, defaults to None
- Raises:
XQException – failed packet creation
- Returns:
api response, the encrypted packet
- Return type:
text
- xq.api.subscription.key_management.create_and_store_packets(api, recipients: list, expires_hours: int = 24, keys: list | None = None, type: int = 5, subject: str | None = None, meta: str | None = None)
creates an encrypted packet from a secret key https://xq.stoplight.io/docs/xqmsg/1f9bc1713a7cd-create-and-save-a-new-key-packet
- Parameters:
api (XQAPI) – XQAPI instance
recipients (list) – list of emails to grant access to
expires_hours (int, optional) – packet validation time in hours, defaults to 24
key (bytes, optional) – secret key to encrypt, defaults to None
- Raises:
XQException – failed packet creation
- Returns:
api response, the encrypted packet
- Return type:
text
- xq.api.subscription.key_management.create_packet(api, recipients: list, expires_hours: int = 24, key: bytes | None = None, type: int = 3, subject: str | None = None)
creates an encrypted packet from a secret key https://xq.stoplight.io/docs/xqmsg/b3A6NDA5MDQ5MTY-create-a-new-key-packet
- Parameters:
api (XQAPI) – XQAPI instance
recipients (list) – list of emails to grant access to
expires_hours (int, optional) – packet validation time in hours, defaults to 24
key (bytes, optional) – secret key to encrypt, defaults to None
- Raises:
XQException – failed packet creation
- Returns:
api response, the encrypted packet
- Return type:
text
xq.api.subscription.user_management module
- xq.api.subscription.user_management.authorize_alias(api, user_email: str, firstName: str, lastName: str)
request an access token for the given user information https://subscription.xqmsg.net/v2/authorizealias
- Parameters:
api (XQAPI) – XQAPI instance
user_email (str) – email address of user requesting access token
firstName (str) – first name of user
lastName (str) – last name of user
- Returns:
access token
- Return type:
str
- xq.api.subscription.user_management.authorize_user(api, user_email: str, firstName: str, lastName: str, newsletter=False, notifications=0)
request pre-auth token for a given email address, this token will need to be exchanged for an access token https://xq.stoplight.io/docs/xqmsg/b3A6NDA5MDAxNDE-request-access-for-a-user
- Parameters:
api (XQAPI) – XQAPI instance
user_email (str) – email address of user requesting access token
firstName (str) – first name of user
lastName (str) – last name of user
newsletter (bool, optional) – subscribe to newsletter, defaults to False
notifications (int, optional) – notification level: 0 = No Notifications, 1 = Receive Usage Reports, 2 = Receive Tutorials, 3 = Receive Both, defaults to 0
- Returns:
pre-aut token, which can be exchanged for an access token
- Return type:
str