Login Wordpress With Requests - Python3
import requests with requests.Session() as s: headers1 = {'Cookie':'wordpress_test_cookie=WP Cookie check'} datas={'log':'admin','pwd':'admin','wp-submit':'Log In','redire
Solution 1:
Your code is ok, but you should submit the post data to /wp-login.php, not /wp-admin/
wp_login = 'http://ip/wordpress/wp-login.php'
wp_admin = 'http://ip/wordpress/wp-admin/'
username = 'admin'
password = 'admin'with requests.Session() as s:
headers1 = { 'Cookie':'wordpress_test_cookie=WP Cookie check' }
datas={
'log':username, 'pwd':password, 'wp-submit':'Log In',
'redirect_to':wp_admin, 'testcookie':'1'
}
s.post(wp_login, headers=headers1, data=datas)
resp = s.get(wp_admin)
print(resp.text)
If it still doesn't work try with 'Referer' and 'User-Agent' in the headers
Post a Comment for "Login Wordpress With Requests - Python3"