使用python登录到网站

使用python登录到网站,python,login,web-scraping,Python,Login,Web Scraping,在本网页中: 我正在尝试使用python使用纽约大学的链接登录,这是我尝试过的: import requests url ='https://shibboleth.nyu.edu/idp/profile/SAML2/Redirect/SSO?execution=e1s1' login_data = { 'j_username': username, 'j_password': password, } data = urllib.parse.urlencode(login_d

在本网页中:

我正在尝试使用python使用纽约大学的链接登录,这是我尝试过的:

import requests
url ='https://shibboleth.nyu.edu/idp/profile/SAML2/Redirect/SSO?execution=e1s1'
login_data = {
   'j_username': username,
   'j_password': password,
    }
data = urllib.parse.urlencode(login_data)
s.headers.update(headers)
resp = s.post(url, data=data)
但它不起作用,它将我重定向到此页面:


请让我知道我犯了什么错误,或者我是否必须选择另一种方法。谢谢您的帮助。

重定向?您的
url
值正好是
”https://shibboleth.nyu.edu/idp/profile/SAML2/Redirect/SSO?execution=e3s1“
!没有重定向-你直接请求它我在问题的url中出错了,我编辑了它。正确的url是,但仍然会发生相同的事情。