How to processing multi redirect?

G

Gonnasi

I want fetching some articles from nytimes.com for my Palm, and I want
a clear, simple article too, my Palm has only 8M RAM.

With the WGET, I can fetching the page like:
"http://www.nytimes.com/2005/10/26/business/26fed.html?pagewanted=print",
and when WGET works, I can see the URL have been redirect many times.

When I run the below code with Python:
I just get a error message: "HTTP Error 302: The HTTP server returned a
redirect error that would lead to an infinite loop. The last 30x error
message was: Moved Temporarily"

Why I can't fetching the page with python, but WGET can do it?

Thanks for your help in advance!
 
D

David Wahler

Gonnasi said:
I want fetching some articles from nytimes.com for my Palm, and I want
a clear, simple article too, my Palm has only 8M RAM.

With the WGET, I can fetching the page like:
"http://www.nytimes.com/2005/10/26/business/26fed.html?pagewanted=print",
and when WGET works, I can see the URL have been redirect many times.

When I run the below code with Python:

I just get a error message: "HTTP Error 302: The HTTP server returned a
redirect error that would lead to an infinite loop. The last 30x error
message was: Moved Temporarily"

Why I can't fetching the page with python, but WGET can do it?

Thanks for your help in advance!

Hi,

Your problem is that you're not preserving cookies from one request to
the next. nytimes.com redirects you to an automatic login page which
sets a cookie; this cookie is required to view the original page, or
else it'll get stuck in a loop. This fixes the problem:

Hope this helps,

-- David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top