Google App Engine + Python中的REST API? [英] REST API in Google App Engine + Python?
问题描述
如何使用Google App Engine和Python创建RESTful API?我尝试过使用云端点,但文档不关注RESTful API。有没有类似于GAE的django-tastypie?
RESTful API可以基于EndPoint API构建。有些工具可以帮助您更轻松地完成工作: b
$ b
appengine rest server(不基于端点)
Google App Engine应用程序的Drop-in服务器,通过REST API公开您的数据模型,无需额外工作。
https://code.google.com/p/appengine-rest-server/
另一个基于端点
通过扩展ndb提供的功能.Model类和端点库,该库允许您直接与您的API方法中的模型实体交互,而不是ProtoRPC请求。例如,而不是:
https://github.com/GoogleCloudPlatform/endpoints-proto-datastore
EDIT1:
<#在一行中生成restful api
BigDataLab = EndpointRestBuilder(EndpointRestBuilder GPCode).build(
api_name =BigDataLab,
name =bigdatalab,
version =v1,
description =My Little Api
)
回购:
https://github.com/Tagtoo/endpoints-proto-datastore-restHow create a RESTful API using Google App Engine with Python? I've tried using Cloud Endpoints, but the documentation does not focus on a RESTful API. Is there something similar to django-tastypie for GAE?
解决方案The RESTful api can be build based on EndPoint API. There are some tools can help you make things easier:
appengine rest server (not based on endpoints)
Drop-in server for Google App Engine applications which exposes your data model via a REST API with no extra work.
https://code.google.com/p/appengine-rest-server/
Another one is based on endpoints
By extending the functionality provided by ndb.Model class and the endpoints library, this library allows you to directly interact with model entities in your API methods rather than ProtoRPC requests. For example, instead of:
https://github.com/GoogleCloudPlatform/endpoints-proto-datastore
EDIT1:
I wrote a RESTFul api generator for endpoints.
# generate restful api in one line BigDataLab = EndpointRestBuilder(GPCode).build( api_name="BigDataLab", name="bigdatalab", version="v1", description="My Little Api" )
repo: https://github.com/Tagtoo/endpoints-proto-datastore-rest
这篇关于Google App Engine + Python中的REST API?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!