好友
阅读权限10
听众
最后登录1970-1-1
|
本帖最后由 Heart灬欣 于 2020-8-9 14:58 编辑
header1 = {
"Content-Type": "text/html;charset=GBK",
"Vary": "Accept-Encoding"
}
url = "http://ea.swmu.edu.cn/jsxsd/"
requests.session().get(url=url, headers=header1, timeout=1000)
cookies = requests.session().cookies.get_dict() # 获得临时的cookies
cookies = str(cookies).replace("{", '').replace("'", '').replace(":", '=').replace('}', '').replace(",", ";")
cookies = cookies.replace(" ", '')
header = {
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;"
"q=0.8,application/signed-exchange;v=b3",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "zh-CN,zh;q=0.9",
"Cache-Control": "max-age=0",
"Content-Length": "47",
"Content-Type": "application/x-www-form-urlencoded", # 接收类型
"Cookie": cookies,
"Host": "ea.swmu.edu.cn",
"Origin": "http: // ea.swmu.edu.cn",
"Proxy-Connection": "keep-alive",
"Referer": "http://ea.swmu.edu.cn/jsxsd/",
"Upgrade-Insecure-Requests": "1",
"User-Agent": "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 "
"(KHTML, like Gecko) Chrome/76.0.3809.132 Mobile Safari/537.36",
}
PostData = {
'encoded': encoded # 账号密码加密后的东西(这里在没有粘贴的代码是解决了的)
}
url = 'http://ea.swmu.edu.cn/jsxsd/xk/LoginToXk'
msg = requests.session().post(url, headers=header, data=PostData, timeout=1000)# 这里登陆成功了msg是登陆成功的那个界面目前遇到的问题是我已经登陆成功了,但是不知道如何获取这个网站的其它内容,百度过相关的代码,是直接使用:r=requests.session().get(url)
但是还是不行,不知问题出在哪了.求高手指点一下 谢谢了!
|
|
发帖前要善用【论坛搜索】功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。 |
|
|
|
|