我正在尝试登录我的xfinity帐户,然后在https://customer.xfinity.com/apis/中获取信息并获取我的活动服务列表。问题是它不能验证我的身份
import requests, lxml.html
import json
username = 'myusername'
password = 'mypassword'
s= requests.session()
login = s.get('https://login.xfinity.com/login')
login_html = lxml.html.fromstring(login.text)
hidden_inputs = login_html.xpath('//form//input[@type="hidden"]')
form = {x.attrib["name"]: x.attrib["value"] for x in hidden_inputs}
form['user'] = username
form['passwd'] = password
form['continue'] = 'https://customer.xfinity.com/apis/'
form['forceAuthn'] = 'true'
print(form)
response = s.post('https://login.xfinity.com/login', data=form)
#print(response.text)
#res = s.get('https://customer.xfinity.com/#/settings/account')
res = s.get('https://customer.xfinity.com/apis/')
print(res.text)
我希望输出显示在屏幕上,但是我得到了 {“错误”:“未经身份验证”}