import requests


def makeHTTP(requestUrl, timeOut=1):
    """ sends a request to an http(s) endpoint

    Parameters
    ----------
    requestUrl : str
        url to call
    timeOut : int
        optional - call timeout

    Returns
    -------
    response
        a string which is a string returned from the http call

    Exceptions
    ----------
    SpaceXReadTimeOut
        raised when the API call breaches the timeout limit
    """
    try:
        url_response = requests.get(url=str(requestUrl), timeout=timeOut, headers={   # noqa: E501
            'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'}  # noqa: E501
                                    )
    except requests.exceptions.ReadTimeout:
        raise TimeoutError('HTTP Timeout Error')
    else:
        response = url_response.text
    return response