我完全无法登录此页面:
https://login.wyborcza.pl/
我试过这个解决方案:
import requests
# Fill in your details here to be posted to the login form.
payload = {
'name': 'username',
'pass': 'password'
}
# Use 'with' to ensure the session context is closed after use.
with requests.Session() as s:
login_url = "https://login.wyborcza.pl/"
p = s.post(login_url, data=payload)
# print the html returned or something more intelligent to see if it's a successful login page.
print p.text
# the authorised request.
r = s.get('A protected web page url')
print r.text
# etc...
我在这里找到的,但我只得到一个400状态。
谢谢阅读。
更新:
出现另一个问题:当我尝试使用 request.get() 在此页面中阅读时,我收到一条消息,提示已启用广告拦截器,但未加载页面内容。但是,如果我尝试在浏览器中访问该页面,则没有问题 - 所有内容都已加载。
import requests
# Fill in your details here to be posted to the login form.
payload = {
'username': 'username',
'password': 'password'
}
# Use 'with' to ensure the session context is closed after use.
with requests.Session() as s:
login_url = "https://login.wyborcza.pl/services/ajax/wyborcza/login"
p = s.post(login_url, data=payload)
# print the html returned or something more intelligent to see if it's a successful login page.
cookiesALL = s.cookies.get_dict()
智慧大石
相关分类