Get filename from given urlopen
object and URL.
First, tries the “Content-Disposition”, if unavailable, extracts name from the URL.
If this fails, the default
keyword will be used.
- Parameters:
sock (urlopen
) – The urlopen
to parse for the filename.
url (str
) – The URL to parse for the filename.
default (str
, optional) – The name to use if the first two methods fail. Defaults to “file”.
- Returns:
bytes
– The filename in file system encoding.