get_filename

sunpy.util.net.get_filename(sock, url)[source] [edit on github]

Get filename from given urlopen object and URL.

First, tries the “Content-Disposition”, if unavailable, extracts name from the URL.

Parameters
  • sock (urlopen) – The urlopen to parse for the filename.

  • url (str) – The URL to parse for the filename.

Returns

str – The filename.