Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

urllib2 and Keep-alive

Status
Not open for further replies.

damonkohler

Programmer
Dec 9, 2004
1
US
I'm trying to automate a form submission. But it seems that after a few tries by the script to get on the page (3 actually), I get error 302 infinite redirect on every following attempt. After sniffing the traffic, the only difference that I can detect is that Python is issuing a Connection: close header instead of using keep-alive. I think maybe the server is denying access since multiple connections are being opened.

I haven't been able to figure out how to get keep-alive working. Some things I have read say that it is supported, but I'm not sure. Just setting the header doesn't seem to work (it gets over-ridden by a Connection: close). And if it is supported, is it supported in conjuction with cookielib? I'm using Python 2.4 so cookielib has ClientCookie builtin. Any thoughts would be greatly appreciated!
 
The 302 redirect is a message that comes from the server you're trying to post to. I don't know that urllib handles that automatically, you may need to write code to follow the redirect.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top