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


Groups > comp.lang.python > #77434

urllib2 redirect error

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <sumitbu.ray@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.024
X-Spam-Evidence '*H*': 0.95; '*S*': 0.00; 'subject:error': 0.03; 'http': 0.09; 'errors:': 0.16; 'exception:': 0.16; 'loop.': 0.16; 'skip:u 50': 0.16; 'skip:u 70': 0.16; 'library': 0.18; 'error': 0.23; 'versions': 0.24; "i've": 0.25; 'tried': 0.27; 'appreciated.': 0.29; 'moved': 0.30; 'returned': 0.30; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'requests': 0.31; 'but': 0.35; 'received:google.com': 0.35; 'thanks': 0.36; 'hi,': 0.36; 'skip:- 20': 0.37; 'server': 0.38; 'to:addr:python-list': 0.38; 'skip:- 10': 0.38; 'to:addr:python.org': 0.39; 'skip:u 10': 0.60; 'url:htm': 0.73; 'was:': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=phbMcPWz/uxVxfAedU3+3llVqbbSGFGcXp/veGKKcEQ=; b=uOwY6B5Mdh2+JpqIFfiF4wG8HSUVQPTm59/UfTctX6DGY1fdBvvPdewv/4LlbErAuS B/IsIjJpK9DEfG5wvcAOy4TcEpeu87eTDaQ9F5hutPcRsC4rAFq/z/IdZULNF79xBtzL VG9SCXtrF8Wva0OjeGUNUduo+zFL/fdgiNsGKu2hRiqQ7FKiSz7tmQ7NOmzXx4LianHG Q5HcdXzx05N55FH9LdIthftRXGfp8xGP1A4/KZ5VqfM8qohQD1OG13eshsO3Eq9qUuyF aiErA9Pv1ENk9ucZNCtHtc6Z4nE62PeD1KnvBMUTmQxJXSUyjAGcuFIKppLz9llT6ML5 I+WA==
MIME-Version 1.0
X-Received by 10.43.126.8 with SMTP id gu8mr6573icc.79.1409638127932; Mon, 01 Sep 2014 23:08:47 -0700 (PDT)
Date Tue, 2 Sep 2014 02:08:47 -0400
Subject urllib2 redirect error
From Sumit Ray <sumitbu.ray@gmail.com>
To python-list@python.org
Content-Type multipart/alternative; boundary=bcaec517cd0ae0999705020ef3f4
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.13708.1409638130.18130.python-list@python.org> (permalink)
Lines 55
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1409638130 news.xs4all.nl 2965 [2001:888:2000:d::a6]:50394
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:77434

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

Hi,

 I've tried versions of the following but continue to get errors:

------------- snip -------------
url = 'https://www.usps.com/send/official-abbreviations.htm'
request = urllib2.build_opener(urllib2.HTTPRedirectHandler).open(url)
------------- snip -------------

Generates an exception:
urllib2.HTTPError: HTTP Error 301: The HTTP server returned a redirect
error that would lead to an infinite loop.
The last 30x error message was:
Moved Permanently


The following using the requests library hangs:
------------- snip -------------
response = requests.get(url)
------------- snip -------------

I'm fresh out of ideas and any suggestions you may have would be greatly
appreciated.

Thanks in advance,
Sumit

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

urllib2 redirect error Sumit Ray <sumitbu.ray@gmail.com> - 2014-09-02 02:08 -0400
  Re: urllib2 redirect error Steven D'Aprano <steve@pearwood.info> - 2014-09-02 07:28 +0000
    Re: urllib2 redirect error dieter <dieter@handshake.de> - 2014-09-03 08:29 +0200
    Re: urllib2 redirect error Sumit Ray <sumitbu.ray@gmail.com> - 2014-09-06 09:24 -0700

csiph-web