简单的Google Cloud Endpoints应用

时间:2013-10-21 14:25:10

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

经过2天多的努力想弄清楚如何让它发挥作用,我现在要求帮助了。这只是一个简单的应用程序,只是为了让Google Cloud Endpoints正常运行。它部署良好但实际上不起作用。它很难调试,因为没有错误消息可以搞清楚。这是我的代码:

的app.yaml

application: [my-simple-api]
version: 1
runtime: python27
threadsafe: true
api_version: 1

handlers:
- url: /_ah/spi/.*
  script: main.application

libraries:
- name: endpoints
  version: "1.0"

main.py

#should this be "from google.appengine.ext import endpoints"?
import endpoints
from protorpc import messages
from protorpc import message_types
from protorpc import remote

class SimpleMessage(messages.Message):
    message = messages.StringField(1)

@endpoints.api(name='simple', version='v1')
class SimpleApi(remote.Service):

    @endpoints.method(message_types.VoidMessage, SimpleMessage, path='simpleget', http_method='GET', name='simple.get')
    def simple_get(self, unused_request):
        return SimpleMessage(message="hello this is a simple api")

application = endpoints.api_server([SimpleApi])

0 个答案:

没有答案