[英]Can I use PUT http method with Python Bottle?
我正在尝试这样做:
@get("/admin/questions/:question_id")
def question (question_id):
pass
#Some code for returning the question
@put("/admin/questions/:question_id")
pass
#I intend to write some code to update the question here.
这可能吗? GET和POST确实有效,PUT显然不起作用。
是的,你可以这样做。 查看文档:
例:
from bottle import put, run
@put("/foo")
def foo():
return "Foo"
run()
我有同样的问题。 以上链接很有帮助。 我还发现这些网页很有用:
http://gotofritz.net/blog/weekly-challenge/restful-python-api-bottle/ (周末代码战士在一个页面中创建了一个安静的界面 - 这让我很清楚)
http://www.marginhound.com/bottle-py-resources/ http://isbullsh.it/2011/11/Python-micro-frameworks/ http://publish.luisrei.com/articles/flaskrest.html
一旦我花时间浏览这些页面,就可以轻松实现。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.