Error 400 in urllib2 when using cookies
Posted
by
Hempage
on Stack Overflow
See other posts from Stack Overflow
or by Hempage
Published on 2011-01-09T04:49:18Z
Indexed on
2011/01/09
4:53 UTC
Read the original article
Hit count: 183
I've had some success using a different method to load cookies, but now I'm wanting to use the cookielib.MozillaCookieJar method to open a cookies.txt file. Here's the snippet of code that does this.
cookieJar=MozillaCookieJar()
cookieJar.load(argv[2])
After creating an HTTPCookieProcessor opener, and installing it, whenever I use urlopen, I get an HTTP 400 error. However, if I don't use a CookieJar, the urlopen method succeeds (though the response doesn't contain the data I need).
I'm not sure whether the cookies.txt file is malformed, or whether there's something else going on.
© Stack Overflow or respective owner