嘿,使用发帖请求登录网站时遇到麻烦。任何帮助都会很棒。
import requests
import json
headers = {'content-type': 'application/json'}
url = 'https://atcbuilder.io/login.php'
data = {"form_username":" shortman443", "form_password":" Owensag2"}
params = {'sessionKey': '9ebbd0b25760557393a43064a92bae539d962103', 'format': 'xml', 'platformId': 1}
r = requests.post(url, params=params, data=json.dumps(data), headers=headers)
print(r.text)
答案 0 :(得分:0)
关于这种问题,您应该学习如何使用工具,例如Fiddler
。要捕获http响应并观察boswer和requests
之间的区别。
import requests
url = 'https://atcbuilder.io/login.php'
data = {"form_username":"test", "form_password":"test"} #if your pwd and username dont contain space,then dont add it.otherwise you never login successfully
r = requests.post(url, data=data)
print(r.text.find("Logout"))
print(r.text.find("Sign Up"))