def _download(self):
try:
try:
import urllib.request
from urllib.error import URLError, HTTPError
with urllib.request.urlopen(self.url) as response, \
open(self.outputfile_origin, 'wb') as outfile:
shutil.copyfileobj(response, outfile)
except (AttributeError, ImportError):
import urllib
urllib.urlretrieve(self.url, self.outputfile_origin)
except (URLError, HTTPError, IOError, Exception) as e:
logger.debug("Unable to retrieve %s for %s", self.url, e)
评论列表
文章目录