我正在为我的大学创建一个申请,学生必须登录以获取他的数据。该网站发布了这样的参数
发布参数的页面内容。
<input checked="checked" id="SchSel_chkSkip" name="SchSel$chkSkip" type="checkbox"/>
<input id="SchSel_hidLastLogin" name="SchSel$hidLastLogin" type="hidden"/>
<input id="SchSel_hidSchoolId" name="SchSel$hidSchoolId" type="hidden" value="-1"/>
<input id="SchSel_hidSchoolName" name="SchSel$hidSchoolName" type="hidden"/>
<input id="SchSel_hidCoreUserDet" name="SchSel$hidCoreUserDet" type="hidden"/>
<input id="SchSel_hidSessionId" name="SchSel$hidSessionId" type="hidden" value="-1"/>
<input id="SchSel_hidActiveSchool" name="SchSel$hidActiveSchool" type="hidden" value="-1"/>
<input id="SchSel_hidReportingDet" name="SchSel$hidReportingDet" type="hidden" value="-1"/>
<input id="SchSel_hidActiveSession" name="SchSel$hidActiveSession" type="hidden" value="-1"/>
<input id="SchSel_hidHitCount" name="SchSel$hidHitCount" type="hidden" value="378284"/>
<input id="SchSel_hidSchoolAddress" name="SchSel$hidSchoolAddress" type="hidden" value="0"/>
<input id="SchSel_hdnLoginAsUser" name="SchSel$hdnLoginAsUser" type="hidden"/>
我所知道的唯一数据是SchSel $ txtUserName和SchSel $ txtPassword,我可以发布但是如何获取其他值
我尝试了什么:
import requests
s = requests.Session()
url = 'https://nucleus.niituniversity.in/Default.aspx'
login_data = {'ScriptManager1' : 'SchSel$up|SchSel$btnLogin',
'__LASTFOCUS' : '',
'__EVENTTARGET' : '',
'__EVENTARGUMENT' : '',
'__VIEWSTATE' : '/wEPDwUKMTg3OTYzNDk4Nw9kFgICAw9kFhICAQ8PFgIeB1Zpc2libGVoZGQCAg8PFgIfAGhkZAIDDwdkxvZ2luDw9kZmQaZNVi16vCv',
'__VIEWSTATEGENERATOR' : 'CA0B0334',
'SchSel$cmbUserType' : 'Student',
'SchSel$txtUserName' : 'user',
'SchSel$txtPassword' : '1234',
'SchSel$chkSkip' : 'on',
'SchSel$hidLastLogin' : '2016-2017',
'SchSel$hidSchoolId' : '1',
'SchSel$hidSchoolName' : 'School name',
'SchSel$hidCoreUserDet' : '815106',
'SchSel$hidSessionId' : '8',
'SchSel$hidActiveSchool' : '1',
'SchSel$hidReportingDet' : '0',
'SchSel$hidActiveSession' : '1',
'SchSel$hidHitCount' : '3',
'SchSel$hidSchoolAddress' : 'Address',
'SchSel$hdnLoginAsUser' : '',
'__ASYNCPOST' : 'true',
'SchSel$btnLogin.x' : '42',
'SchSel$btnLogin.y' : '14'
}
s.post(url,data = login_data)
res = s.get('Protected page')
但登录失败。虽然我发布了所需的数据但是失败了。?