def _download(self, url): logger.info("Download started: " + url) try: r = requests.get(url) logger.info("Download completed: " + url) if r.status_code == 200: return r.content r.raise_for_status() except requests.exceptions.Timeout as e: logger.error("Connection timed out: " + e.__str__()) except requests.exceptions.RequestException as e: logger.error("Error downloading: " + e.__str__()) return None
def _download(self, url): logger.info('Download started: ' + url) try: r = requests.get(url) logger.info('Download completed: ' + url) if r.status_code == 200: return r.content r.raise_for_status() except requests.exceptions.Timeout as e: logger.error('Connection timed out: ' + e.__str__()) except requests.exceptions.RequestException as e: logger.error('Error downloading: ' + e.__str__()) return None
def log_response(response, **kwargs): logger.info("Download completed: " + response.url)
def log_response(response, **kwargs): logger.info('Download completed: ' + response.url)