I am creating an application for my university in which students has to login as to get his data.The site posts the params like this
content from that page that post the params.
<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"/>
The only data I know is SchSel$txtUserName and SchSel$txtPassword which i can post but how to get other values
What I tried :
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')
But failed to login.why it is failing though i am posting the required data.?