Python form POST using urllib2 (also question on saving/using cookies)

前端 未结 3 1660
无人及你
无人及你 2020-12-07 17:51

I am trying to write a function to post form data and save returned cookie info in a file so that the next time the page is visited, the cookie information is sent to the se

3条回答
  •  甜味超标
    2020-12-07 18:38

    If you are having a hard time making your POST requests to work (like I had with a login form), it definitely pays to quickly install the Live HTTP headers extension to Firefox (http://livehttpheaders.mozdev.org/index.html). This small extension can, among other things, show you the exact POST data that are sent when you manually log in.

    In my case, I had banged my head against the wall for hours because the site insisted on an extra field with 'action=login' (doh!).

提交回复
热议问题