use python3"s Requests library to simulate login failure.
related codes
import requests, bs4
login_url = "https://accounts.104.com.tw/login"
login_data = {
"username": "user01",
"password": "*****",
}
headers = {
"User-Agent": "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Mobile Safari/537.36"
}
s= requests.Session()
r = requests.get(login_url, headers=headers)
-sharp sessionDadaKey
referer_url = r.url
print(r)
print(r.url)
-sharp
k = s.post(referer_url, login_data)
print(k); // <Response [200]>
print(k.url);
I can"t log in all the time using the above code. What"s the problem? Thank you very much
update:
change the above k = s.post (referer_url, login_data) to k = s.post (referer_url, data=login_data) is still not working.
the landing process of this website will go through many jumps, which is more complicated, because you don"t know what to do and ask for help.