我使用此代码登录了baiscopelk.com
print(res_1) == <Response [302]>
print(res_1) == <Response [403]>
我不明白问题所在
import requests
headers = {
'Connection': 'keep-alive',
'Cache-Control': 'max-age=0',
'Origin': 'https://www.baiscopelk.com',
'Upgrade-Insecure-Requests': '1',
'Content-Type': 'application/x-www-form-urlencoded',
'User-Agent': 'Mozilla/5.0 (Windows NT 6.3) AppleWebKi'
't/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
'Referer': 'https://www.baiscopelk.com/wp-login.php',
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'si,en;q=0.9,en-US;q=0.8',
}
data = {
'log': 'baiscopelk.username',
'pwd': 'baiscopelk.password',
'wp-submit': 'Log In',
'redirect_to': 'https://www.baiscopelk.com/wp-admin/',
'testcookie': '1'
}
res_0 = requests.get('https://www.baiscopelk.com/wp-login.php', headers=headers)
res_1 = requests.post('https://www.baiscopelk.com/wp-login.php', headers=headers, data=data, cookies=res_0.cookies,
allow_redirects=False)
print(res_1)