Use Python to download the file, even though it cannot authenticate the
    connection.

def download_file_insecure_to_io(url, target_file=None, headers={}):
    """
    Use Python to download the file, even though it cannot authenticate the
    connection.
    """

    src = None
    try:
        req = Request(
            url,
            data=None,
            headers=headers
        )

        src = urlopen(req)

        # Read/write all in one block, so we don't create a corrupt file
        # if the download is interrupted.
        data = src.read()
        target_file.write(data)
    finally:
        if src:
            src.close()