Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #7952
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'exits': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'def': 0.12; 'examples': 0.12; 'wrote:': 0.14; '200)': 0.16; 'received:forthnet.gr': 0.16; 'code.': 0.22; 'fri,': 0.23; '(e.g.': 0.26; 'script': 0.27; 'testing': 0.27; 'class': 0.29; 'implement': 0.30; 'none,': 0.30; 'headers': 0.32; 'header:X -Complaints-To:1': 0.32; 'to:addr:python-list': 0.33; 'header :User-Agent:1': 0.35; 'quite': 0.36; 'response': 0.37; 'received:org': 0.38; 'but': 0.38; 'subject:: ': 0.38; 'header :Mime-Version:1': 0.39; 'to:addr:python.org': 0.39; 'your': 0.60; 'forget': 0.61; 'received:62': 0.68 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | "Elias Fotinis" <efotinis@yahoo.com> |
| Subject | Re: HTTPConncetion - HEAD request |
| Date | Sun, 19 Jun 2011 16:21:32 +0300 |
| References | <b06bf827-671c-4555-b3ec-108bc5c3a0b8@m10g2000yqd.googlegroups.com> <mailman.69.1308304747.1164.python-list@python.org> <38df1fae-a7bd-43c3-8b3d-b8d685af4b9f@fp11g2000vbb.googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed; delsp=yes |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | 62.1.231.136.dsl.dyn.forthnet.gr |
| User-Agent | Opera Mail/11.11 (Win32) |
| X-Antivirus | avast! (VPS 110618-1, 06/19/2011), Outbound message |
| X-Antivirus-Status | Clean |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.145.1308489706.1164.python-list@python.org> (permalink) |
| Lines | 20 |
| NNTP-Posting-Host | 82.94.164.166 |
| X-Trace | 1308489706 news.xs4all.nl 49174 [::ffff:82.94.164.166]:43355 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:7952 |
Show key headers only | View raw
On Fri, 17 Jun 2011 20:53:39 +0300, gervaz <gervaz@gmail.com> wrote: > I decided to implement this solution: > > class HeadRequest(urllib.request.Request): > def get_method(self): > return "HEAD" > > Now I download the url using: > > r = HeadRequest(url, None, self.headers) > c = urllib.request.urlopen(r) > > but I don't know how to retrieve the request status (e.g. 200) as in > the previous examples with a different implementation... Use c.getcode() to get the response code. When you're testing interactively, you might find printing the headers with "print c.headers" quite handy. Don't forget to close the response (c.close()) when your script exits its experimental state.
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
HTTPConncetion - HEAD request gervaz <gervaz@gmail.com> - 2011-06-16 15:43 -0700
Re: HTTPConncetion - HEAD request Ian Kelly <ian.g.kelly@gmail.com> - 2011-06-16 17:00 -0600
Re: HTTPConncetion - HEAD request gervaz <gervaz@gmail.com> - 2011-06-17 01:19 -0700
Re: HTTPConncetion - HEAD request Chris Angelico <rosuav@gmail.com> - 2011-06-17 18:44 +1000
Re: HTTPConncetion - HEAD request Adam Tauno Williams <awilliam@whitemice.org> - 2011-06-17 06:14 -0400
Re: HTTPConncetion - HEAD request gervaz <gervaz@gmail.com> - 2011-06-17 10:53 -0700
Re: HTTPConncetion - HEAD request "Elias Fotinis" <efotinis@yahoo.com> - 2011-06-19 16:21 +0300
csiph-web