how to use python scripts to simulate the login?
how to use python scripts to simulate the login? below is my php website code,
login.html: Code:
<html> Code:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> i want to simulate login and it can reponse me success or failure? but i try to use below python scripts,but it did not response success or fialure to me.how to modify it? Code:
#coding:utf-8 |
Hi!
Not really sure what you are trying to do here. First of all, you are not sending any POST requests with your Python script. I suggest that you A) Use Python 3 in conjunction with requests, and B) Check this link for further information: http://stackoverflow.com/questions/1...d-post-request Furthermore, here's an example of how I would read a web page in Python 3 with urllib: Code:
>>> import urllib.request Best regards, HMW |
Quote:
finaly i want to check the login is unnormal or normal. i try to modify it this:(but no matter the username and password is right or wrong) it print sucess. Code:
#coding:utf-8 |
Quote:
Read more here: http://www.python-course.eu/python3_...n_handling.php Basically, your code ALWAYS throws an exception, therefore you will ALWAYS get login success as a result. If you need to use Python for this, you're gonna have to learn the language. There is (in my view) an excellent course (free) here: http://www.pythonlearn.com/html-009/ Best regards, HMW |
All times are GMT -5. The time now is 04:56 PM. |