我有一组使用Google云端点开发的api。API方法如下所示:
@endpoints.method(message_types.VoidMessage, SystemAboutResponse, name="about", http_method="GET")
def about(self, request):
"""
Returns some simple information about the APIs.
Example:
...
"""
return SystemAboutResponse(version=API_VERSION)
我想使用pydoc为包含此方法的模块生成文档。但是,在执行此操作时,由于使用了端点.方法装饰工。在
我已经看到了其他问题的答案,这些问题展示了如何使用函数工具.wrapps(例如Python decorator handling docstrings)编写您自己的decorator,以便它们保留修饰方法的docstring时。既然我无法控制这些装饰器的代码,那么有没有什么方法可以用Google云端点装饰器来实现呢?在
最后我对端点库的一个副本进行了本地修改。变化在api中_配置.py,特别是
method
装饰器的apiserving_method_decorator
函数。我向@wraps
中包含的invoke_remote
函数添加了@wraps
装饰:然后,当我运行pydoc时,我要确保端点库的这个本地修改副本在我的
PYTHONPATH
中。在相关问题 更多 >
编程相关推荐