Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use PUT http method with Python Bottle?

I'm trying to do this:

@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.

Is this possible? GET and POST do work, PUT is apparently not working.

like image 633
martincho Avatar asked Mar 26 '26 15:03

martincho


1 Answers

Yes, you can do this. See the documentation:

  • http://bottlepy.org/docs/dev/tutorial.html#http-request-methods
  • http://bottlepy.org/docs/dev/api.html#bottle.put

Example:

from bottle import put, run

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

run()

Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!