why i cant login this site using python in a post method -


This is my code for logging a site using Python:

  Import urllib2, cookielib cookie_support = Urllib2.HTTPCookieProcessor (cookielib.CookieJar ()) Opener = urllib2.build_opener (cookie_support, urllib2.HTTPHandler) urllib2.install_opener (Opener) content = urllib2.urlopen ('http://192.168.1.200/order /index.php? Op = login and ac = login and user name =% e 8% b 5% b 5% e 6% b1% 9 f% e 6% 98% 8 e and user pd = 123 '). Read () print content   

it shows:

  {"title": "Login error", "body": "Username or password error "," Data ": {" status ": 1}}   

But the username and password are correct, I can use this site to firefox,

So what can I do,

thanks

you request a GET To post the request, use it:

  content = urllib2.urlopen ('http://192.168.1.200/order/index.p Hp ',' op = login & ac = login & username =% e8% b5% b5% e6% b1% 9f% e6% 98% 8 e and userpid = 123 '). Read ()   

urlopen method sends a POST request if the data (second argument) is passed to it.

Comments