urlopen

Get filename when using urllib.urlopen

I'm using urllib.urlopen to read a file from a URL. What is the best way to get the filename? Do servers always return the Content-Disposition header? Thanks. ...

Python urllib2.urlopen bug: timeout error brings down my Internet connection?

I don't know if I'm doing something wrong, but I'm 100% sure it's the python script brings down my Internet connection. I wrote a python script to scrape thousands of files header info, mainly for Content-Length to get the exact size of each file, using HEAD request. Sample code: class HeadRequest(urllib2.Request): def get_method(...