文章内容

2023/7/7 2:55:03,作 者: 黄兵

TypeError: Rule.__init__() got an unexpected keyword argument 'method'

在重启 Flask 项目的时候出现了如下错误:

TypeError: Rule.__init__() got an unexpected keyword argument 'method'

出现错误的原因:

代码错误,下面是错误代码:

@dashboard.route('/onetime-verify-code', method=['GET'])

这里应该是 methods 而不是 method。

解决方案:

更改代码,修改成如下内容:

@dashboard.route('/onetime-verify-code', methods=['GET'])

最后问题解决。


参考资料:

1、TypeError: __init__() got an unexpected keyword argument 'method'


其他相关推荐:

1、AttributeError: 'AnonymousUser' object has no attribute 'id'

2、TypeError: unsupported operand type(s) for *: 'decimal.Decimal' and 'float'

3、Invalid leading whitespace, reserved character(s), or returncharacter(s) in header value

4、AttributeError: 'function' object has no attribute 'route'

5、400 Bad Request: The browser (or proxy) sent a request that this server could not understand.


黄兵个人博客原创。

转载请注明出处:黄兵个人博客 - TypeError: Rule.__init__() got an unexpected keyword argument 'method'

分享到:

发表评论

评论列表