Python3 encountered an error while accessing the asp page using requests.

the official WeChat of the school has an one-click function to check grades, and I have always wanted to be able to do it. Now I am learning python, and I am going to use it to practice, but I made a 500th error during the interview.

here is the code:
python

import requests
import time
import hashlib
from user import user

url1 =" http://202.115.133.173:805/Common/Handler/UserLogin.ashx"
url2 =" http://202.115.133.173:805/Default.aspx"
url3 =" http://202.115 . 133.173 : 805GForm.aspx"
username = user.name
password = user.pwd
sign = int (time.time () * 1000)
headers = {

"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Accept-Encoding": "gzip, deflate, compress",
"Accept-Language": "en-us;q=0.5,en;q=0.3",
"Cache-Control": "max-age=0",
"Connection": "keep-alive",
"Host":"202.115.133.173:805",
"Referer":"",
"Upgrade-Insecure-Requests":"1",
"User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:22.0) Gecko/20100101 Firefox/22.0"






}

def treatpwd (user, sign, pwd):

pwdmd5 = hashlib.md5()
pwdmd5.update(pwd.encode("utf-8"))
loginpwd = pwdmd5.hexdigest()
return loginpwd

datas = {

"Action":"Login",
"userName":username,
"pwd":treatpwd(username, sign, password),
"sign":sign,

}

if name = "_ _ main__":

req = requests.Session()
headers["Referer"] = url1
print(headers)
req.headers.update(headers)

resp1 = req.post(url1,data=datas)
print(resp1)
headers["Referer"] = url1
print(headers)
req.headers.update(headers)
print(req.headers)

resp2 = req.get(url2)
print(resp2.headers)
headers["Referer"] = url2
req.headers.update(headers)

resp3 = req.get(url3)
print(resp3.headers)
print(resp3)

after I looked it up on the Internet, I found that it might be a problem with refer, but there was a problem updating refer.

the following is the output information:

{"Accept":" text/html,application/xhtml+xml,application/xml;q=0.9, / ; qroom0.8, "Accept-Encoding":" gzip, deflate, compress", "Accept-Language":" en-us;q=0.5,en; Q href= 0.3, "Cache-Control":" max-age=0", "Connection":" keep-alive", "Host":" 202.115.133.173 Cache-Control": 805, "Referer":" < Response >
{"Accept":" text/html,application/xhtml+xml,application/xml;q=0.9, / ; qroom0.8, "Accept-Encoding":" gzip, deflate, compress", "Accept-Language":" en-us;q=0.5,en; Q href= 0.3, "Cache-Control":" max-age=0", "Connection":" keep-alive", "Host":" 202.115.133.173 Cache-Control": 805, "Referer":"
{"User-Agent":" Mozilla/5.0 (X11; Ubuntu; Linux x86 / 64; rv:22.0) Gecko/20100101 Firefox/22.0", "Accept-Encoding":" gzip, deflate, compress", "Accept":" text/html,application/xhtml+xml,application/xml;q=0.9, / ; QQ 0.8, "Connection":" keep-alive", "Accept-Language":" en-us;q=0.5,en; Qroom0.3mm, "Cache-Control":" max-age=0", "Host":" 202.115.133.173 Host": 805mm, "Referer":" http://202.115.133.173:805/Common/Handler/UserLogin.ashx", "Upgrade-Insecure-Requests":" 1"}
{"Content-Type":" text/html", "Content-Encoding":" gzip", "Last-Modified":" Thu, 23 Nov 2017 03:09:08 GMT", "Accept-Ranges":" bytes", "ETag":" "0a24a6d864d31:0", "Vary":" Accept-Encoding", "Server":" Microsoft-IIS/7.5", XKI Powerwood Bybeans: "ASP.NET"," Date": "Sat, 07 Apr 2018 13:19:10 GMT", "Content-Length":" 1329"}
{"Cache-Control":" private", "Content-Type":" text/html; Charset=utf-8", "Server":" Microsoft-IIS/7.5","X Response Response Versionmakers: "4.0.30319," Xmuri Powerplay Bybeans: "ASP.NET"," Date": "Sat, 07 Apr 2018 13:19:11 GMT"," Content-Length": "4179"}
< Response >

Process finished with exit code 0

now I feel a little dizzy and don"t know what to do.
by the way: when I output the source code of the respons after a successful login, I find that it is also wrong, indicating that there is a problem on the page that has successfully logged in.

Mar.01,2021

you should provide a test account, otherwise who can help you?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e9c92d-18ea.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e9c92d-18ea.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?