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: 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 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 --bcaec517cd0ae0999705020ef3f4 Content-Type: text/plain; charset=UTF-8 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 --bcaec517cd0ae0999705020ef3f4 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi,

=C2=A0I've tried versions of th= e following but continue to get errors:

------------- sn= ip -------------
request =3D 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 infini= te loop.
The last 30x error message was:
Moved Permanently


The following using the requests librar= y hangs:
------------- snip -------------
response =3D = requests.get(url)
------------- snip -------------

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

Thanks in advance,
Sumit



--bcaec517cd0ae0999705020ef3f4--