python post请求demo2

来源:互联网 发布:snap.svg.js实例教程 编辑:程序博客网 时间:2024/05/18 01:12
#!/usr/bin/python# coding=utf-8import urllib2values ={}data='''info={"username":"xxxx@foxmail.com","password":"x3d8d1200d278df5664761922ff2cEHBQ","code":"","autologin":false}'''# data = urllib.urlencode(data)req = urllib2.Request("https://www.oshadan.com/validateLogin",data)req.add_header('Host','www.oshadan.com')req.add_header('User-Agent','Mozilla/5.0 (X11; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0')req.add_header('Accept','application/json, text/javascript, */*; q=0.01')req.add_header('Accept-Language','zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3')req.add_header('Accept-Encoding','gzip, deflate, br')req.add_header('Content-Type','application/x-www-form-urlencoded; charset=UTF-8')req.add_header('X-Requested-With','XMLHttpRequest')req.add_header('Referer','https://www.oshadan.com/login')req.add_header('Content-Length','115')resp = urllib2.urlopen(req)print resp.read()
0 0
原创粉丝点击