def create_security_token(api_key, stage):
    '\n    Generates a security token for SBT API access.\n\n    Args:\n        api_key (string): API_KEY value provided by solutionsbytext\n        stage (string): STAGE values (test or ui)\n\n    Returns:\n        string: SecurityToken returns by LoginAPIService\n\n    Raises:\n        CustomException: Raises while error during GET request.\n\n    '
    url = ''.join([_base_url.format(stage), 'LoginAPIService.svc/AuthenticateAPIKey?', parse.urlencode({'APIKey': api_key})])
    response_data = json.loads(requests.get(url).text)
    if (response_data['AuthenticateAPIKeyResult'].get('ErrorCode') == 1402):
        raise CustomException('Error in generating security key.')
    if (response_data['AuthenticateAPIKeyResult'].get('ErrorCode') == 1401):
        raise CustomException('SecurityToken generation is failed.')
    return response_data['AuthenticateAPIKeyResult'].get('SecurityToken')
Generates a security token for SBT API access.

Args:
    api_key (string): API_KEY value provided by solutionsbytext
    stage (string): STAGE values (test or ui)

Returns:
    string: SecurityToken returns by LoginAPIService

Raises:
    CustomException: Raises while error during GET request.
def create_security_token(api_key, stage):
    '\n    Generates a security token for SBT API access.\n\n    Args:\n        api_key (string): API_KEY value provided by solutionsbytext\n        stage (string): STAGE values (test or ui)\n\n    Returns:\n        string: SecurityToken returns by LoginAPIService\n\n    Raises:\n        CustomException: Raises while error during GET request.\n\n    '
    url = .join([_base_url.format(stage), 'LoginAPIService.svc/AuthenticateAPIKey?', parse.urlencode({'APIKey': api_key})])
    response_data = json.loads(requests.get(url).text)
    if (response_data['AuthenticateAPIKeyResult'].get('ErrorCode') == 1402):
        raise CustomException('Error in generating security key.')
    if (response_data['AuthenticateAPIKeyResult'].get('ErrorCode') == 1401):
        raise CustomException('SecurityToken generation is failed.')
    return response_data['AuthenticateAPIKeyResult'].get('SecurityToken')