python - 使用python解析时无法检索用户名
问题描述
下面是我的代码片段:
#from bs4 import BeautifulSoup
import requests
session = requests.Session()
payload = {'user': 'user@comcast.net',
'passwd': 'password'}
s = session.post("https://login.xfinity.com/", data=payload)
s = session.get('https://customer.xfinity.com/#/?CMP=ILC_signin_myxfinity_re')
#soup = BeautifulSoup(s.text, 'html.parser')
print(s.text)
执行上述代码后,我将尝试从 s.text 中检索用户名。但它不携带我登录 xfinity 帐户时出现的用户名。
只有当我使用浏览器手动登录帐户时,我才能看到用户名。如何检索我需要的所有信息?PS:1.我确实尝试了图书馆“webbot”。但这不是我在代码中使用的偏好。我愿意使用“请求”之类的库。2. 我也试过其他网站,我也遇到同样的错误
解决方案
考虑到我的网络应用程序在 IE 以外的任何浏览器中都不兼容,我目前找不到解决方案来实现这一点。
推荐阅读
- java - 无法在 Android aosp 中解析 org.bouncycastle.cms
- htmx - 有没有办法让 hx-trigger 依赖于选定的值?
- jenkins-kubernetes - 有没有办法在 powerPC (ppc64le) 架构上安装 Jenkins-Operator?
- window - 配置不同类型的参数 GPO
- visio - 如何从 Visio 自定义形状的子形状中引用形状的数据
- c++ - 如何从使用 GMock 模拟的模拟类中触发 Qt Signal
- authentication - 在 OnePlus 8T OxygenOS 11 应用程序无法正常工作
- image - 在 Tkinter 中的 vlc 上绘制透明图像
- javascript - wait for response from api for 5 sec if response taking time put in console log
- python - 如何使用python提取文本文件中的特定段落?