【发布时间】:2011-10-21 21:00:28
【问题描述】:
我正在尝试在龙卷风上实现某种 API,我有这样的问题: 是否可以将两个 url 路由到一个按方法分隔的处理程序。
class Handler():
def get(self):
#only for the first url
def post(self):
#only for the secornd url
handlers = [
(r"/url1",Handler), #only GET are allowed
(r"/url2",Handler), #only POST are allowed
]
因此,如果有人尝试将 POST 发送到第一个 url,他应该会看到错误消息
【问题讨论】:
标签: python url-routing tornado