服务在谷歌云端点多个API
问题描述:
我试图服务于2层不同的API有一组不同的方法,如记录在这里:https://cloud.google.com/endpoints/docs/deploying-apis-subdomains服务在谷歌云端点多个API
通过GCE,这是在我的main.py结构如下
@endpoints.api(name = 'first', version = 'v1')
class firstApi(remote.Service):
@endpoints.method(
# Lots of stuff here
path = 'first'
# Lots more here
@endpoints.api(name = 'second', version = 'v1')
class secondApi(remote.Service):
@endpoints.method(
# Lots of stuff here
path = 'second'
# Lots more here
api = endpoints.api_server([firstApi, secondApi])
但是当我生成firstv1openapi.json和secondv1openapi.json并部署它们时,会发生一些奇怪的事情。当我在谷歌的API资源管理器中加载它,我看到都 API的
更糟糕的是,当我点击第二个API,并通过API探险尝试任何方法,下两方法路径始终引用第1个API。
POST https://my_backend_here.appspot.com/_ah/api/第一/V1/第二
其预期失败,一个404
我已经看了两个firstv1openapi.json和secondv1openapi.json,看看API的十字架完全相互引用,他们都看起来很好。
我出于尝试不同的选择,任何帮助将不胜感激。
答
我看到你正在使用Python端点框架。该框架目前仅适用于App Engine的标准环境,而不适用于GCE。