我正在尝试使用 endpoints_proto_datastore 为我的应用程序引擎应用程序创建一些端点,它可以工作,因为 url 返回一些东西,但不是我所期望的。
这是我知道的代码,有些导入是不需要的,但它们是临时的
模型文件
import endpoints
from google.appengine.ext import db
import webapp2
from endpoints_proto_datastore.ndb import EndpointsModel
class Estate(EndpointsModel):
hicid = db.IntegerProperty()
name = db.StringProperty()
address= db.PostalAddressProperty()
contact_phone = db.PhoneNumberProperty()
contact_name = db.StringProperty()
contact_email = db.EmailProperty()
location = db.GeoPtProperty()
created = db.DateTimeProperty(auto_now_add=True)
updated = db.DateTimeProperty(auto_now=True)
API 文件
import endpoints
from google.appengine.ext import ndb
from protorpc import remote
from endpoints_proto_datastore.ndb import EndpointsModel
from models.estate import *
@endpoints.api(name = 'raceManagerAPI', version = 'v1', description = 'An api for access to important data')
class raceManagerAPI(remote.Service):
@Estate.query_method(path = 'estates', name = 'estate.list')
def EstateList(self, query):
return query
app.yaml 文件
application: yellow-fox
version: 1
runtime: python27
api_version: 1
threadsafe: yes
handlers:
- url: /assets
static_dir: assets
- url: /signup
script: main.app
secure: always
- url: /login
script: main.app
secure: always
- url: /forgot
script: main.app
secure: always
# Endpoints Api
- url: /_ah/spi/.*
script: main.application
- url: .*
script: main.app
libraries:
- name: webapp2
version: "2.5.1"
- name: jinja2
version: latest
- name: endpoints
version: latest
main.py 文件中有这个
application = endpoints.api_server([raceManagerAPI], restricted=False)
这就是我从 api explorer 得到的
{
"kind": "raceManagerAPI#estateItem",
"etag": "\"hx0GGGqNWMq76QilvaW15fvq6DI/taVVBKufuJZtJ6w1S7kF6sHCh4M\""
}
我所期待的是一个项目清单,有人可以告诉我哪里出错了,文档并没有给我太多的想法。