【发布时间】:2014-03-30 20:54:13
【问题描述】:
我正在使用 Requests 库将 PUT 数据发送到 Pipeline Deals API,并且数据要求我在请求 data 中为值添加一个列表。
他们的例子:"custom_label_83": [ 28, 29 ]。
这就是我 PUTting 数据的方式:
requests.put("https://www.pipelinedeals.com/...", data={'custom_label_83': [28,29]})
问题似乎是当我PUT那个例子时,我最终只有29是PUT,因为请求的主体(编码后)是这样的:
custom_label_83%5D=28&custom_fields%5D%5Bcustom_label_83%5D=29
因此,该字段设置了两次,最终结果为29,而不是同时包含28 和29 的列表。我希望PUT 请求的正文是这样的:
custom_label_83%5D=28,29
我该怎么做?
【问题讨论】:
标签: python http python-2.7 python-requests url-encoding