Python flask-restful框架讲解 (3)

更新一个任务

$ curl :5000/todos/todo3 -d "task=something different" -X PUT -v * Trying ::1... * TCP_NODELAY set * Connection failed * connect to ::1 port 5000 failed: Connection refused * Trying 127.0.0.1... * TCP_NODELAY set * Connected to localhost (127.0.0.1) port 5000 (#0) > PUT /todos/todo3 HTTP/1.1 > Host: localhost:5000 > User-Agent: curl/7.64.1 > Accept: */* > Content-Length: 24 > Content-Type: application/x-www-form-urlencoded > * upload completely sent off: 24 out of 24 bytes * HTTP 1.0, assume close after body < HTTP/1.0 201 CREATED < Content-Type: application/json < Content-Length: 38 < Server: Werkzeug/1.0.1 Python/3.9.2 < Date: Sat, 06 Mar 2021 03:32:44 GMT < { "task": "something different" } * Closing connection 0

获取最新列表

$ curl :5000/todos { "todo1": { "task": "build an API" }, "todo3": { "task": "something different" }, "todo4": { "task": "something new" } }

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wsswxd.html