我有一组使用 Google Cloud Endpoints 开发的 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 为包含此方法的模块生成文档。但是,当我这样做时,由于使用了 endpoints.method 装饰器,文档字符串不会被保留。
我已经看到了其他问题的答案,这些问题展示了在编写自己的装饰器时如何使用 functools.wraps(例如Python 装饰器处理文档字符串),以便它们保留装饰方法的文档字符串。有没有办法使用 Google Cloud Endpoints 装饰器来做到这一点,因为我无法控制这些装饰器的代码?