coroweb.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:awesome-python3-webapp 作者: syusonn 项目源码 文件源码
def add_route(app,fn):
    method = getattr(fn,'__method__',None)
    path = getattr(fn,'__route__',None)
    if path is None or method is None:
        return ValueError('@get or @post not defined in %s' % str(fn))
    if not asyncio.iscoroutinefunction(fn) and not inspect.isgeneratorfunction(fn):
        fn = asyncio.coroutine(fn)
    logging.info('add route %s %s => %s(%s)' % (method,path,fn.__name__,','.join(inspect.signature(fn).parameters.keys())))
    app.router.add_route(method,path,RequestHandler(app,fn))

#????URL??
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号