If I open a file using urllib2, like so:
remotefile = urllib2.urlopen(\'http://example.com/somefile.zip\')
Is there an easy way to get the
I guess it depends what you mean by parsing. There is no way to get the filename without parsing the URL, i.e. the remote server doesn't give you a filename. However, you don't have to do much yourself, there's the urlparse module:
In [9]: urlparse.urlparse('http://example.com/somefile.zip')
Out[9]: ('http', 'example.com', '/somefile.zip', '', '', '')