GoogleCloudPlatform / endpoints-proto-datastore

Apache License 2.0
154 stars 52 forks source link

endpoints-proto-datastore

|pypi|

This library is intended to be used with the Python version of Google Cloud Endpoints. If you'd like to learn more about Google Cloud Endpoints, please visit our documentation_. To run each of these samples, you should include the endpoints_proto_datastore folder_ included with this project.

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:

.. code:: python

  @endpoints.method(MyModelMessage, MyModelMessage,
                    path='mymodel', http_method='POST',
                    name='mymodel.insert')
  def InsertModel(self, request):
    my_model = MyModel(attr1=request.attr1, attr2=request.attr2, ...)
    transformed_model = DoSomething(my_model)
    return MyModelMessage(attr1=transformed_model.attr1,
                          attr2=transformed_model.attr2, ...)

we can directly use the entity in the request:

.. code:: python

  @MyModel.method(path='mymodel', http_method='POST',
                  name='mymodel.insert')
  def InsertModel(self, my_model):
    return DoSomething(my_model)

without ever even having to define a ProtoRPC message class!

Get started with the examples_.

Project Setup, Installation, and Configuration

To use this library in your App Engine application you can

To install App Engine visit the Development Environment_ page.

Features, Questions and Support

Testing

All tests are wrapped into the endpoints_proto_datastore_test_runner.py_ module. To run the tests, simply execute

.. code:: bash

$ python ${PATH_TO_TEST_RUNNER}/endpoints_proto_datastore_test_runner.py

This test runner assumes that you have App Engine SDK tools on your path and will use the location of the dev_appserver.py script to determine the location of the SDK. For example, on a Unix based system it would be equivalent to:

.. code:: bash

$ dirname `readlink \`which dev_appserver.py\``

Contributing changes

Licensing

.. _documentation: https://developers.google.com/appengine/docs/python/endpoints/ .. _folder: https://github.com/GoogleCloudPlatform/endpoints-proto-datastore/tree/master/endpoints_proto_datastore .. _examples: http://endpoints-proto-datastore.appspot.com/ .. _endpoints_proto_datastore: https://github.com/GoogleCloudPlatform/endpoints-proto-datastore/blob/zipfile-branch/endpoints_proto_datastore.zip?raw=true .. _submodule: http://git-scm.com/book/en/Git-Tools-Submodules .. _Python packages: http://docs.python.org/2/tutorial/modules.html#importing-from-a-package .. _appengine_config.py: https://developers.google.com/appengine/docs/python/tools/appengineconfig .. _Development Environment: https://developers.google.com/appengine/docs/python/gettingstartedpython27/devenvironment .. _file an issue: https://github.com/GoogleCloudPlatform/endpoints-proto-datastore/issues/new .. _ask a question: http://stackoverflow.com/questions/ask?tags=endpoints-proto-datastore .. _endpoints_proto_datastore_test_runner.py: https://github.com/GoogleCloudPlatform/endpoints-proto-datastore/blob/master/endpoints_proto_datastore/endpoints_proto_datastore_test_runner.py .. _CONTRIB.md: https://github.com/GoogleCloudPlatform/endpoints-proto-datastore/blob/master/CONTRIB.md .. _pycco: http://fitzgen.github.io/pycco/ .. _LICENSE: https://github.com/GoogleCloudPlatform/endpoints-proto-datastore/blob/master/LICENSE .. _listed under terms other than Apache 2.0: http://twistedmatrix.com/trac/browser/trunk/LICENSE

.. |pypi| image:: https://img.shields.io/pypi/v/endpoints-proto-datastore.svg :target: https://pypi.python.org/pypi/endpoints-proto-datastore