wordpress - How to use Python to login and detect error if the combination is wrong -


I want to connect to my site using a python script and find out when login fails. For example, when the login is incorrect, the URL is not ahead of wp-login.php / wp-admin / and gives you this message:

  Error: The password you entered is the username Wrong Is Your Password Lost?  

I want the method to detect two types of errors: 1-The URL is not changed. 2-Error message and this is my code so far to find the error message:

  import urllib2 import re html_content = urllib2.urlopen ('http://example.com/login' ) .read () Match = Re.findall ('Error', html_content); If LAN (match) == 0: print 'log in error' and: 'login login successful'  

Thank you guys for someone ^ _ ^

Please note that while working with Python for Web Dev, it is most convenient to use the already established framework, such as That flask that worksheg (simple and efficient).

I recommend that you are reading here on Python Web Development

And if you are unfamiliar with the way you use it From the Python official doctor:

"Web server gateway interface, or short for WSGI, is defined in PEP 333 and currently Python is the best way to do web programming. Very good for, a normal web developer does not need to contact directly with it. It is a good idea to choose a framework for web development, which is WSGI's summer "

I recommend flask because it is really simple. But also look at

It is not possible that what you were expecting, but do not show us your current code and tell us what you have tried, we Do not

Or to do this more clearly, turn on the stack overflow when you invest some efforts in research to solve your problem and apply the solution or two After fails.


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -