def test_url(self, url, data=None, method='get', ok_test=(200, 304, 302), log=True, counter=None):
    if data is None:
        data = {}
    func = getattr(self, method.lower())
    r = func(url, data=data)
    
    result = False
    if isinstance(ok_test, (list, tuple)):
        result = r.status_code in ok_test
    #int,long will be treated as status code
    elif isinstance(ok_test, (int, long)):
        result = r.status_code == ok_test
    #str,unicode will be treated as text
    elif isinstance(ok_test, (str, unicode)):
        result = ok_test in r.data
    elif callable(ok_test):
        result = ok_test(url, data, method, r.status_code, r.data)    

    if counter:
        counter.add(result)
        
    flag = 'OK' if result else 'Failed'
    log_func = None
    if callable(log):
        log_func = log
    elif log is True:
        log_func = log_to_file(sys.stdout)
    elif isinstance(log, (str, unicode)):
        log_func = log_to_file(log)
    if log_func:
        log_func(url, data, method, ok_test, result, r)
    return result
Test if an url is ok
dataset/ETHPy150Open limodou/uliweb/uliweb/utils/test.py/test_url