get_filename#

sunpy.util.net.get_filename(sock, url)[source]#

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.