0

有没有办法在 protorpc 服务路径中添加变量?类似于webapp2 url 模板

4

1 回答 1

0

我认为您正在寻找资源容器:

来自https://developers.google.com/appengine/docs/python/endpoints/getstarted/backend/write_api_post

ID_RESOURCE = endpoints.ResourceContainer:

MULTIPLY_METHOD_RESOURCE = endpoints.ResourceContainer(
        Greeting,
        times=messages.IntegerField(2, variant=messages.Variant.INT32,
                                    required=True))

@endpoints.method(MULTIPLY_METHOD_RESOURCE, Greeting,
                  path='hellogreeting/{times}', http_method='POST',
                  name='greetings.multiply')
def greetings_multiply(self, request):
    return Greeting(message=request.message * request.times)
于 2014-08-21T20:05:24.877 回答