urllib, urlretrieve method, how to get headers?
clp2 at rebertia.com
Fri Jul 1 09:30:44 CEST 2011
On Fri, Jul 1, 2011 at 12:03 AM, Даниил Рыжков <daniil.re at gmail.com> wrote:
> Hello, everyone!
> How can I get headers with urlretrieve? I want to send request and get
> headers with necessary information before I execute urlretrieve(). Or
> are there any alternatives for urlretrieve()?
You can use regular urlopen(), get the headers using the .info()
method of the resulting object, and do the file writing manually.
More information about the Python-list