def _download_file(self, url, auth, headers, file_path):
    t1 = time.time()
    try:
        response = self.requester.get(url, stream=True, verify=self.verify, auth=auth, headers=headers)
    except Exception as exc:
        raise ConanException(("Error downloading file %s: '%s'" % (url, exc)))
    if (not response.ok):
        if (response.status_code == 404):
            raise NotFoundException(('Not found: %s' % url))
        elif (response.status_code == 401):
            raise AuthenticationException()
        raise ConanException(('Error %d downloading file %s' % (response.status_code, url)))
    try:
        logger.debug(('DOWNLOAD: %s' % url))
        data = self._download_data(response, file_path)
        duration = (time.time() - t1)
        log_download(url, duration)
        return data
    except Exception as e:
        logger.debug(e.__class__)
        logger.debug(traceback.format_exc())
        raise ConanConnectionError(('Download failed, check server, possibly try again\n%s' % str(e)))
def _download_file(self, url, auth, headers, file_path):
    t1 = time.time()
    try:
        response = self.requester.get(url, stream=True, verify=self.verify, auth=auth, headers=headers)
    except Exception as exc:
        raise ConanException(("Error downloading file %s: '%s'" % (url, exc)))
    if (not response.ok):
        if (response.status_code == 404):
            raise NotFoundException(('Not found: %s' % url))
        elif (response.status_code == 401):
            raise AuthenticationException()
        raise ConanException(('Error %d downloading file %s' % (response.status_code, url)))
    try:
        logger.debug(('DOWNLOAD: %s' % url))
        data = self._download_data(response, file_path)
        duration = (time.time() - t1)
        log_download(url, duration)
        return data
    except Exception as e:
        logger.debug(e.__class__)
        logger.debug(traceback.format_exc())
        raise ConanConnectionError(('Download failed, check server, possibly try again\n%s' % str(e)))