Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/327.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我可以在Python瓶子中使用PUT http方法吗?_Python_Rest_Bottle - Fatal编程技术网

我可以在Python瓶子中使用PUT http方法吗?

我可以在Python瓶子中使用PUT http方法吗?,python,rest,bottle,Python,Rest,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和POS

我正在尝试这样做:

@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-do-work,PUT显然不起作用。

我发现这个:。它可能有用。

是的,你可以这样做。请参阅文档:

例如:

from bottle import put, run

@put("/foo")
def foo():
    return "Foo"

run()

我也有同样的问题。上面的链接很有帮助。我还发现这些网页很有用:

(weekend code warrior在一个页面中创建restful界面——这对我来说非常清楚)

一旦我花时间浏览了这些页面,它就非常容易实现