命令如下:
curl -X POST -d '{ "method" : "test", "params" : [ { "detail" : "Hello_world"} ] }' http://example.com
在 bash 里面执行是能得到想要的结果的。但希望在 python 里面搞。
其中 data 的部分是 { "method" : "test", "params" : [ { "detail" : "Hello_world"} ] }
我不太清楚怎么用 python requests 处理 [ { "detail" : "Hello_world"} ] 这个部分。
现在的做法是 os.system 写到一个文件里,再把文件里的内容读出来,囧。
curl -X POST -d '{ "method" : "test", "params" : [ { "detail" : "Hello_world"} ] }' http://example.com
在 bash 里面执行是能得到想要的结果的。但希望在 python 里面搞。
其中 data 的部分是 { "method" : "test", "params" : [ { "detail" : "Hello_world"} ] }
我不太清楚怎么用 python requests 处理 [ { "detail" : "Hello_world"} ] 这个部分。
现在的做法是 os.system 写到一个文件里,再把文件里的内容读出来,囧。