经过 2 多天的尝试弄清楚如何使它工作,我现在要寻求帮助。这只是一个简单的应用程序,只是为了让 Google Cloud Endpoints 工作。它部署良好,但实际上无法正常工作。很难调试,因为没有错误消息可以解决。这是我的代码:
应用程序.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"
主文件
#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])