Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #8628 > unrolled thread

Re: urllib, urlretrieve method, how to get headers?

Started byChris Rebert <clp2@rebertia.com>
First post2011-07-01 00:30 -0700
Last post2011-07-01 00:30 -0700
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: urllib, urlretrieve method, how to get headers? Chris Rebert <clp2@rebertia.com> - 2011-07-01 00:30 -0700

#8628 — Re: urllib, urlretrieve method, how to get headers?

FromChris Rebert <clp2@rebertia.com>
Date2011-07-01 00:30 -0700
SubjectRe: urllib, urlretrieve method, how to get headers?
Message-ID<mailman.537.1309505452.1164.python-list@python.org>
On Fri, Jul 1, 2011 at 12:03 AM, Даниил Рыжков <daniil.re@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.

Cheers,
Chris
--
http://rebertia.com

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web