weblib.control

weblib.control.repeat(func, limit=3, args=None, kwargs=None, fatal_exceptions=(), valid_exceptions=())[source]

Return value of execution func function.

In case of error try to execute func maximum limit times and then raise latest exception.

Example:

def download(url):
    return urllib.urlopen(url).read()

data = repeat(download, 3, args=['http://google.com/'])
weblib.control.sleep(lower_limit, upper_limit)[source]

Sleep for random number of seconds in interval between lower_limit and upper_limit