예제 #1
0
def _get_filename(response):
    content_disposition = response.headers.get('content-disposition', None)
    if content_disposition:
        match = re.findall('filename="(.+?)"', content_disposition)
        if match:
            return match[0]
    return download_util.get_file_name(response.url)
예제 #2
0
 def _sync_ftp_download(self, url, destination_path):
     out_path = os.path.join(destination_path,
                             download_util.get_file_name(url))
     urllib.request.urlretrieve(url, out_path)
     hexdigest, size = utils.read_checksum_digest(
         out_path, checksum_cls=self._checksumer)
     return hexdigest, size