[英]Cannot login to my school website
I am trying to use a python script (specifically requests) for logging into my university account and having the program do what I need it to do. 我正在尝试使用python脚本(特别是请求)登录我的大学帐户并让程序执行我需要它做的事情。 I used the following code to try logging into the website:
我使用以下代码尝试登录网站:
import requests
import time
url = 'https://myschool.edu/'
next_url = 'https://mynextpage.edu/'
login_data = {"j_username":'input username here', "j_password":'input password here'}
with requests.Session() as s:
s.get(url)
p = s.post(url, data=login_data)
# print the html returned or something more intelligent to see if it's a successful login page.
print p.text
time.sleep(40)
# An authorised request.
r = s.get(next_url)
print r.text
When I have p.text print out, all I see is the html to the original login page. 当我打印出p.text时,我看到的只是原始登录页面的html。 I don't understand what I am typing wrong about this.
我不明白我输错了什么。 Thanks for all your help!!
感谢你的帮助!!
1 feels like programming while 2 is more like hacking. 1感觉像编程,而2更像是黑客攻击。 ;)
;)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.