import hug
something = {'foo': 'bar'}
@hug.put('/')
def update_something():
something['foo'] = <value_of_bar_from_http_put_request>
答案 0 :(得分:2)
import hug
something = {'foo': 'bar'}
@hug.put()
def update_something(bar: hug.types.text):
something['foo'] = bar
return something # may be
然后你可以使用请求来测试
import requests
print(requests.put('http://localhost:8000/update_something',
data={'bar': 'foobar'}).json())