I'm attempting to log into my school's website using Requests, but it doesn't get past the log in page and doesn't return the stuff in the password protected pages. All it does is return the HTML of the login page. Twill would not work as this page requires javascript. . The HTML login stuff is
<!--box content-->
<div id="noscript" class="feedback-alert"> To sign in to PowerSchool, you must use a browser that supports and has JavaScript enabled. </div>
<fieldset id="login-inputs" class="hide">
<div>
<label>Username</label>
<input type="text" id="fieldAccount" name="account" value="" size="39" />
</div>
<div>
<label>Password</label>
<input type="password" name="pw" value="" size="39" /><div id="login-help"><a href="/public/account_recovery_begin.html">Having trouble signing in?</a></div>
</div>
<div id="translatorInput">
<label>Translator Sign In</label>
<input type="password" name="translatorpw" value="" size="39" />
</div>
<div class="button-row">
<button type="submit" id="btn-enter" title="Sign In To PowerSchool Parent Access" value="Enter" border="0" >Sign In</button>
</div>
</fieldset>
<!-- box content-->
I've checked this answer
My current code is
import requests
payload = {
'account': 'username',
'pw': 'password'
}
with requests.Session() as s:
p = s.post('https://powerschool.-/public/home.html', data=payload)
print p.text
r = s.get('https://powerschool.-/guardian/studentsched.html')
print r.text
but I can't seem to log into the page. My question is am I suppose to have a payload to press the 'submit' button or something? I've tried 'action' : 'login' and stuff like that but none of it works. Also, I don't need a translatorpw so should I write 'translatorpw': '' or just ignore that? Obviously I put my real username/password in the program on my laptop. Thanks in advance!
Edit: I just used Selenium and it worked very easily.