Пример #1
0
 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
Пример #2
0
 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
Пример #3
0
 def log_response(response, **kwargs):
     logger.info("Download completed: " + response.url)
Пример #4
0
 def log_response(response, **kwargs):
     logger.info('Download completed: ' + response.url)