comparison core/download.py @ 979:a6331579ff43

Convert ssl_images to use download_file.
author Brian Neal <bgneal@gmail.com>
date Fri, 09 Oct 2015 22:20:32 -0500
parents f5aa74dcdd7a
children 3ebde23a59d0
comparison
equal deleted inserted replaced
978:a828e80223d2 979:a6331579ff43
38 if not path: 38 if not path:
39 content_type = r.headers.get('content-type') 39 content_type = r.headers.get('content-type')
40 suffix = mimetypes.guess_extension(content_type) if content_type else '' 40 suffix = mimetypes.guess_extension(content_type) if content_type else ''
41 if suffix == '.jpe': 41 if suffix == '.jpe':
42 suffix = '.jpg' 42 suffix = '.jpg'
43 elif suffix is None:
44 suffix = ''
43 fd, path = tempfile.mkstemp(suffix=suffix) 45 fd, path = tempfile.mkstemp(suffix=suffix)
44 os.close(fd) 46 os.close(fd)
45 47
46 try: 48 try:
47 with open(path, 'wb') as fp: 49 with open(path, 'wb') as fp: