lib.url

Module Contents

Functions

parse_url(url) Parse an URL
add_url_params(url,params) Add some parameter to an URL.
add_split_url_params(parsed_url,new_params)
uri_validator(url) A simple validator for URL’s.
url_to_base64(url) Request the document at the given url and return it as a base64 document.
parse_url(url)

Parse an URL

Args:
url (str): The URL
Returns:
(urlparse.SplitResult, dict): the parsed URL (SplitResult, params)
add_url_params(url, params)

Add some parameter to an URL.

Args:
url (str): The base URL params (dict): The parameters to add
Returns:
str: The new URL
add_split_url_params(parsed_url, new_params)
uri_validator(url)

A simple validator for URL’s.

Args:
url (str): The url which should be checked to be valid.
Returns:
bool: The state of the validation.
url_to_base64(url)

Request the document at the given url and return it as a base64 document.

Args:
url (str): url to request and deliver as base64 document.
Returns:
base64 or str: the document as base64 string or None on empty urls
Raises:
LookupError: Raised if the response is not code 200. AttributeError: Raised if the URL itself isn’t valid at all.