且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法让Google端点通过多种服务工作

更新时间:2022-12-19 21:40:04

我相信这个问题仅存在于dev_appserver中,因为我和您在本地存在相同的问题,但是一旦部署,它就可以正常工作.

I believe this issue only exists with dev_appserver, as I had the same problem as you locally but it worked fine once deployed.

用于终端服务的app.yaml如下:

My app.yaml for my endpoint service looks like this:

runtime: python27
threadsafe: true
api_version: 1
service: <module-name>

handlers:
- url: /_ah/spi/.*
  script: my_script.api

libraries:
- name: pycrypto
  version: 2.6
- name: endpoints
  version: 1.0

部署后,为了打我的api,我向https://<module-name>-dot-<project-name>.appspot.com/_ah/api

Once deployed, in order to hit my api I send requests to https://<module-name>-dot-<project-name>.appspot.com/_ah/api

因此对于您提供的代码,您需要命中的端点为https://<module-name>-dot-<project-name>.appspot.com/_ah/api/<moduleX>/v0/<method> 请注意,<module-name>是在app.yaml中定义的,而<moduleX><method>将在my_script.api中的python代码中声明.

So for the code you gave, the endpoint you would need to hit would be https://<module-name>-dot-<project-name>.appspot.com/_ah/api/<moduleX>/v0/<method> Note that <module-name> is defined in app.yaml and <moduleX> and <method> would be declared in the python code in my_script.api.

为了使它在dev_appserver上本地工作,我相信您需要在自己的dev_appserver实例中运行每个终结点模块,如此处.

In order to get this working locally on dev_appserver, I believe you need to run each endpoint module in its own instance of dev_appserver, as is noted here. Admittedly I have not gotten this to work fully locally, as when I try to do this I get errors about my datastore being locked, but I believe fixing that issue should be possible as noted here.