是否可以在谷歌云端点python中返回字符串

时间:2018-05-01 17:27:49

标签: google-app-engine google-cloud-endpoints-v2

我需要返回一个字符串(纯文本)而不是JSON(类消息)。

现在是我的代码:

    @endpoints.method(
    # This method takes a ResourceContainer defined above.
    Site_resource,
    # This method returns an Echo message.
    Site_response_new,
    path='test',
    http_method='POST',
    name='testsystem')
def testsystem(self, request):
    return Site_response_new(result=data)

我想这样做:

  @endpoints.method(
    # This method takes a ResourceContainer defined above.
    Site_resource,
    # This method returns an Echo message.
    str,
    path='test',
    http_method='POST',
    name='testsystem')
def testsystem(self, request):
    return "awesome string"

谢谢你< 3

1 个答案:

答案 0 :(得分:1)

不,目前无法实现。