0
我正在尝试将钩子附加到路由。尽管我遵循文档中的代码,但是一些错误和钩子返回错误,无论我在里面做什么。TypeError:do_before()缺少1个需要的位置参数:'resp'
部件/ counter.py:
def auth_request(req, resp, resource, params):
pass
@falcon.before(auth_request)
class Counter(object):
def on_get(self, req, resp):
pass
app.py:
import falcon
from components import counter
api = application = falcon.API()
api.add_route('/counter', counter.Counter)
当运行此使用gunicorn
和请求localhost:8000/counter
,它返回:
TypeError: do_before() missing 1 required positional argument: 'resp'
哇,有一段时间没有工作,但只是取得旧代码,它的工作原理!谢谢。 –