REST API in Google App Engine + Python?

前端 未结 3 1139
时光说笑
时光说笑 2020-12-23 22:28

How 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 si

3条回答
  •  遥遥无期
    2020-12-23 23:00

    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

提交回复
热议问题