首页 > Web开发 > 详细

requests post一个json数据

时间:2017-07-25 14:11:10      阅读:359      评论:0      收藏:0      [点我收藏+]
# post一个json数据
import requests

headers={

"Accept":"application/json, text/plain, */*",
"Accept-Encoding":"gzip, deflate",
"Accept-Language":"zh-CN,zh;q=0.8",
"appkey":"8dc7959eeee2792ac2eebb490e60deed",
"Connection":"keep-alive",
"Content-Length":"107",
"Content-Type":"application/x-www-form-urlencoded",
"Host":"cq.gsxt.gov.cn",
"Origin":"http://cq.gsxt.gov.cn",
"Referer":"http://q.gsxt.gov.cn/xxgg/xxgg_list.html",
"User-Agent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36",
"X-Requested-With":"XMLHttpRequest"

}

data = {
          "json":‘‘‘{
              "qc": {
                "noticetype": "12"
              },
              "page": {
                "pagesize":"10",
                "currentpage":"1"
              }
            }‘‘‘
          }


url=http://cq.gsxt.gov.cn/gsxt/api/affichebase/queryList

response =requests.post(url,data = data, headers=headers)
# requests.post()
print(response.text)

 

requests post一个json数据

原文:http://www.cnblogs.com/themost/p/7233621.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!