get_system_filename_slugify

sunpy.util.net.get_system_filename_slugify(sock, url, default='file')[source] [edit on github]

Get filename from given urllib2.urlopen object and URL. First, attempts to extract Content-Disposition, second, extract from URL, eventually fall back to default. Returns bytestring in file system encoding, normalized so it shouldn’t violate operating system restrictions.