当前位置:   article > 正文

requests post一个json数据

post request接受一个json blob
# 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)

 

转载于:https://www.cnblogs.com/themost/p/7233621.html

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/运维做开发/article/detail/1016568
推荐阅读
相关标签
  

闽ICP备14008679号