302s and losing cookies with urllib2

后端 未结 4 1883
旧时难觅i
旧时难觅i 2021-01-21 06:13

I am using liburl2 with CookieJar / HTTPCookieProcessor in an attempt to simulate a login to a page to automate an upload.

I\'ve seen some questions and answers on this,

4条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-21 06:54

    I was also having the same problem where the server would respond to the login POST request with a 302 and the session token in the Set-Cookie header. Using Wireshark it was clearly visible that urllib was following the redirect but not including the session token in the Cookie.

    I literally just ripped out urllib and did a direct replacement with requests and it worked perfectly first time without having to change a thing. Big props to those guys.

提交回复
热议问题