【发布时间】:2014-03-10 10:49:52
【问题描述】:
import requests
import json
url='http://test.com/job/MY_JOB_NAME/build'
params={'name':'BRANCH', 'value':'master', 'name':'GITURL', 'value':'https://github.test.com/test/test.git'}
payload = json.dumps(params)
print payload
resp = requests.post(url=url, data=payload)
由于某种原因,请求没有成功执行,所以我打印了有效负载以查看哪些参数作为 json 传递,我得到了这个:
{"name": "GITURL", "value": "https://github.scm.corp.ebay.com/RPS/RPS.git"}
为什么我的有效载荷缺少前 2 个 json 键值对?
【问题讨论】:
-
字典只存储唯一键。
标签: python json python-2.7 dictionary python-requests