python3.4 信息门户登录请求

来源:互联网 发布:pl sql scott登录不了 编辑:程序博客网 时间:2024/05/01 03:19

python post请求

import requestsurl = 'http://xx.xxxx.edu.cn/userPasswordValidate.portal'user=20160001parms={    'Login.Token1': user,    'Login.Token2': '123456',    'captchaField': '485c'}headers = {    'Connection':'keep-alive',    'Content-Length': '174',    'Cache-Control': 'max-age=0',    'Origin': 'http://xx.xxxx.edu.cn',    'Upgrade-Insecure-Requests': '1',    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36',    'Content-Type': 'application/x-www-form-urlencoded',    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',    'Referer': 'http://xx.xxxx.edu.cn/',    'Accept-Encoding': 'gzip, deflate',    'Accept-Language': 'zh-CN,zh;q=0.8',    'Cookie': 'JSESSIONID=0000O1UhImqKAdSpqQwJ6Nz9Tow:17kv91lok'}resp = requests.post(url, data=parms, headers=headers)text = resp.textprint(text)
0 0