校园网每天都需要自己登录,可以做个自动化
这是来自于网络上的智慧,
1 # USE PYTHON TO LOGIN SCHOOL NET 2 # After fill in your account and password, just 'python login.py' directly, then the network will login automatically. 3 # If you can not import requests, please try - pip install requests 4 import requests 5 6 headers = { 7 'Accept': '*/*', 8 'Accept-Encoding': 'gzip,deflate,br', 9 'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8,ja;q=0.7', 10 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36', 11 'X-Requested-With': 'XMLHttpRequest', 12 'Referer': 'https://a.stu.edu.cn:444/ac_portal/20170602150308/pc.html?template=20170602150308&tabs=pwd&vlanid=0&_ID_=0&switch_url=&url=' 13 } 14 15 data = { 16 'opr' : 'pwdLogin', 17 'userName' : '14bxye', # Fill in your school account here, for example: 'userName':'14bxye' 18 'pwd' : '123456', # Fill in your school account password here,for example: '123456'. 19 'ipv4or6' : '', 20 'rememberPwd' : '0', 21 } 22 23 url = 'https://a.stu.edu.cn:444/ac_portal/login.php' 24 25 login = requests.post(url, data = data, headers = headers, verify = False)
要将python脚本保存在一个无中文或中文符号的路径下
就可以自动登录了