Python请求lib。 Json要求

时间:2016-04-11 15:13:04

标签: python json python-requests

我在尝试在请求中格式化JSON时遇到问题,(我正在使用requests库。)

这是我应该发送的内容,这是一个正确的请求,其中收到200 OK

{
   "servers":[
      {
         "host":"willi.ci.hi",
         "port":"2921",
         "text":[
            "A: willi.ci.hi 2921 william 12345"
         ]
      }
   ],
   "share":true
}

这是我用requests发送的内容,以模拟请求:

json = {'host': 'willi.ci.hi', 
        'port': '2921', 
        'lines': 'C: willi.ci.hi 2921 william 12345', 
        'share': 'true'}

response = requests.post('http://www.test.com/validate', json=json, proxies=proxy, headers=headers, cookies=cookie)

这是我用代理(使用Burp代理)捕获的内容,我真正发送的内容:

{
   "share":"true",
   "host":"willi.ci.hi",
   "text":"A: willi.ci.hi 2921 william 12345",
   "port":"2921"
}

我得到500 Server Internal Error

所有标题都是正确的,我的问题是我发送的Json =(

0 个答案:

没有答案
相关问题