def try_to_read_auth_url(ret):
    match = re.compile('"authURL":"(.+?)"', re.DOTALL | re.UNICODE).findall(ret)
    if len(match) > 0:
        authurl = generic_utility.replace_netfix_secret_code(match[0])
        generic_utility.debug('Setting authorization url: ' + authurl)
        if not test:
            generic_utility.set_setting('authorization_url', authurl)
        else:
            return authurl
    else:
        match = re.compile('name="authURL" value="(.+?)"', re.DOTALL | re.UNICODE).findall(ret)
        if len(match) > 0:
            authurl = generic_utility.replace_netfix_secret_code(match[0])

            generic_utility.debug('Setting authorization url: ' + authurl)
            if not test:
                generic_utility.set_setting('authorization_url', authurl)
            else:
                    return authurl
def parse_api_url(content):
    apiroot = re.compile('"SHAKTI_API_ROOT":"(.+?)",',
                         re.UNICODE).findall(content)
    apibuild = re.compile('"BUILD_IDENTIFIER":"(.+?)",',
                          re.UNICODE).findall(content)
    if len(apiroot) > 0 and len(apibuild) > 0:
        epstr = apiroot[0] + "/" + apibuild[0]
        epstr = generic_utility.replace_netfix_secret_code(epstr)

        generic_utility.set_setting('api_url', epstr)
    else:
        generic_utility.error('Cannot find api url! Source: ' + content)
def try_to_read_auth_url(ret):
    match = re.compile('"authURL":"(.+?)"',
                       re.DOTALL | re.UNICODE).findall(ret)
    if len(match) > 0:
        authurl = generic_utility.replace_netfix_secret_code(match[0])
        generic_utility.debug('Setting authorization url: ' + authurl)
        if not test:
            generic_utility.set_setting('authorization_url', authurl)
        else:
            return authurl
    else:
        match = re.compile('name="authURL" value="(.+?)"',
                           re.DOTALL | re.UNICODE).findall(ret)
        if len(match) > 0:
            authurl = generic_utility.replace_netfix_secret_code(match[0])

            generic_utility.debug('Setting authorization url: ' + authurl)
            if not test:
                generic_utility.set_setting('authorization_url', authurl)
            else:
                return authurl
def parse_endpoints(content):
    match = re.compile('"endpointIdentifiers":({.+?}),', re.UNICODE).findall(content)
    if len(match) > 0:
        epstr = match[0]
        if epstr.endswith("}}"):
            epstr = epstr[:-1]

        epstr = generic_utility.replace_netfix_secret_code(epstr)

        generic_utility.set_setting("endpoints", epstr)
    else:
        generic_utility.error("Cannot find api endpoints! Source: " + content)
def parse_endpoints(content):
    match = re.compile('"endpointIdentifiers":({.+?}),',
                       re.UNICODE).findall(content)
    if len(match) > 0:
        epstr = match[0]
        if epstr.endswith('}}'):
            epstr = epstr[:-1]

        epstr = generic_utility.replace_netfix_secret_code(epstr)

        generic_utility.set_setting('endpoints', epstr)
    else:
        generic_utility.error('Cannot find api endpoints! Source: ' + content)