import requests
import time


def request_url(url, timeout=10, retry=3, retry_interval=0.1, **kwargs):
    """

    :param url:
    :param timeout:
    :param retry:
    :param retry_interval:
    :return:
        success: True, req
        fail: False, None
    """
    params = {'url': url, 'timeout': timeout}
    params.update(kwargs)
    while retry:
        try:
            req = requests.get(**params)
        except:
            retry -= 1
        else:
            if req.status_code == 200:
                return True, req
            else:
                retry -= 1
        time.sleep(retry_interval)

    return False, None