# _*_ coding : utf-8 _*_
import requests # 用于向目标网站发送请求
url = 'http://172.22.0.13/webauth.do?wlanuserip=172.20.91.164&wlanacname=NFV-VBRAS-01&mac=74:4c:a1:a8:25:e3&vlan=1046&rand=1f2613f5e385bc&url=http://211.138.135.94/' # 这行是你需要根据自己的情况修改的地方
data = {
"loginType: ": '', # 这行是你需要根据自己的情况修改的地方
"auth_type": '0', # 这行是你需要根据自己的情况修改的地方
"isBindMac1": "1",
# 下面的这些一般可以直接用(不用改),也有可能要根据你自己的浏览器中的data(数据)做些修改
"pageid": "61",
"templatetype": "1",
"listbindmac": "1",
"recordmac": "0",
"isRemind": "0",
"loginTimes": "",
"groupId": "",
"distoken": "",
"echostr": "",
"url": "http://jwglxt.sanxiau.edu.cn/xtgl/index_initMenu.html?jsdm=",
"isautoauth": "",
"userId": "账号",
"passwd": "密码",
}
# 下面这整个 header 都是需要根据网页中的请求头来做修改
# 下面这整个 header 是我的,你需要按照你自己浏览器中出现的 Response Headers (请求标头)来修改
header = {
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
"Cache-Control": "max-age=0",
"Connectin": "keep-alive",
"Content-Length": "218",
"Content-Type": "application/x-www-form-urlencoded",
"Cookie": "Hm_lvt_d7c7037093938390bc160fc28becc542=1664372603; JSESSIONID=48FAD54385CBAA5F0D411CCC0AABBF0C; softrand=683a563acba1839d668fad00d8ace2f367a1d90cca9f3e8582e3e9514e198ba2; portalUserCookie=50a80df80854fd705ee68f2e8aedfd95949147c80b674e0e6999b52a9e247315b2c2b82463b96eb61bff438d809130fd",
"Host": "172.16.30.45",
"Origin": "http://172.22.0.13",
"Referer": "http://172.22.0.13/webauth.do?wlanuserip=172.20.91.164&wlanacname=NFV-VBRAS-01&mac=74:4c:a1:a8:25:e3&vlan=1046&rand=1f2613f5e385bc&url=http://211.138.135.94/",
"Upgrade-Insecure-Requests": "1",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36 Edg/106.0.1370.42",
}
response = requests.post(url, data, headers=header).status_code
print("状态码{}".format(response))