Source code for argus_api.helpers.urls

from re import findall, sub

[docs]def remove_url_parameters(url): """Removes {parameter} from URL and returns the URL without the parameters :param url: A URL :return: URL without parameters """ return sub(r'{[a-z-A-Z0-9\-]+}/?', '', url)
[docs]def extract_url_parameters(url): """Extracts {parameter} from URL and returns the parameters :param url: A URL :return: Names of all URL based parameters """ return findall(r'\{([a-zA-Z0-9\-_]+)\}', url)