【发布时间】:2015-04-12 14:40:17
【问题描述】:
这是 curl 命令:
curl -H "X-API-TOKEN: <API-TOKEN>" 'http://foo.com/foo/bar' --data #
让我解释一下数据中的内容
POST /foo/bar
Input (request JSON body)
Name Type
title string
body string
所以,基于此..我想:
curl -H "X-API-TOKEN: " 'http://foo.com/foo/bar' --data '{"title":"foobar","body": "这个正文有 "双" 和 '单' 引号" }'
不幸的是,我也无法弄清楚(例如来自 cli 的 curl) 虽然我想使用 python 来发送这个请求。 我该怎么做?
【问题讨论】:
-
你试过一个叫pycurl的库吗?它实际上是 curl 的模拟,具有完全相同的设置和几乎相同的语法。