设计了一套api,然后需要想里面Get,Post数据。一直用Python的
requests
库,发现curl也非常好用
In [8]: data = '{"service":"service01", "regexp":"regexp01"}' In [9]: r = requests.post("http://127.0.0.1:8080/services", data=data) In [10]: r.status_code Out[10]: 200
lee-Macbook-Air:~ lee$ curl -X "POST" http://127.0.0.1:8080/services \ -d '{"service":"service04", "regexp":"regexp04"}' {"success":true}