【发布时间】:2014-08-20 07:49:41
【问题描述】:
Python : curl 命令选项与-d 到 python
我有以下curl bash 脚本,它在终端中返回多行。
curl 'http://localhost/_search?pretty' -d '
{
"query" :{
"range" : {
"created_at" : {
"gte": "now-2h",
"lte": "now"
}
}
}
}'
我想在 python 中运行这个 bash 脚本或curl 命令并在 python 中接收输出。我应该怎么办? requests 似乎不支持curl 命令的选项。
【问题讨论】:
-
您只是想将
curl作为外部程序调用吗? -
不,我想在可以编辑命令的脚本内部调用
-
你说的“编辑命令”是什么意思?
标签: python unix curl python-requests