Package: endpoints-proto-datastore
endpoints-proto-datastoreThis 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 ourdocumentation. To run each of these samples,
you should include theendpoints_proto_datastorefolderincluded with
this project.By extending the functionality provided byndb.Modelclass and theendpointslibrary, this library allows you to directly interact with
model entities in your API methods rather than ProtoRPC requests. For
example, instead of:@endpoints.method(MyModelMessage,MyModelMessage,path='mymodel',http_method='POST',name='mymodel.insert')defInsertModel(self,request):my_model=MyModel(attr1=request.attr1,attr2=request.attr2,...)transformed_model=DoSomething(my_model)returnMyModelMessage(attr1=transformed_model.attr1,attr2=transformed_model.attr2,...)we can directly use the entity in the request:@MyModel.method(path='mymodel',http_method='POST',name='mymodel.insert')defInsertModel(self,my_model):returnDoSomething(my_model)without ever even having to define a ProtoRPC message class!Get started with theexamples.Project Setup, Installation, and ConfigurationTo use this library in your App Engine application you canDownload theendpoints_proto_datastorelibrary and unzip it in the root
of your App Engine application. For example, on a Unix based machine:(${GAE_PROJECT_ROOT})$wget"https://github.com/GoogleCloudPlatform/"``"endpoints-proto-datastore/blob/"``"zipfile-branch/"``"endpoints_proto_datastore.zip?raw=true"\-Oendpoints_proto_datastore.zip(${GAE_PROJECT_ROOT})$unzipendpoints_proto_datastore.zip(${GAE_PROJECT_ROOT})$rmendpoints_proto_datastore.zipAlternatively you can stay up to date by adding this repository to
your project as agitsubmodule:(${YOUR_GIT_ROOT})$gitsubmoduleaddhttps://github.com/GoogleCloudPlatform/endpoints-proto-datastoreThis will create the entire project in theendpoints-proto-datastorefolder in your project. SincePython packagesrequire__init__.pyfiles for imports to work and the root of this project is not meant to be a
Python package, you’ll need to addendpoints-proto-datastoreto your
Python import path.The simplest way to do this is to add the following lines to yourappengine_config.pyfile (or create the file if it doesn’t yet exist):importosimportsysENDPOINTS_PROJECT_DIR=os.path.join(os.path.dirname(__file__),'endpoints-proto-datastore')sys.path.append(ENDPOINTS_PROJECT_DIR)Note: If the App Engine project stored in yourgitrepository
is not at the root, you may need to add a symlink to theendpoints-proto-datastore/endpoints_proto_datastoredirectory and
put it at the root of your App Engine project.To install App Engine visit theDevelopment Environmentpage.Features, Questions and SupportTo request a feature, report a bug, or request a new sample or piece
of documentation; pleasefile an issue.For troubleshooting issues or asking general questions, pleaseask a questionon StackOverflow using theendpoints-proto-datastoretag.TestingAll tests are wrapped into theendpoints_proto_datastore_test_runner.pymodule. To run the tests, simply execute$python${PATH_TO_TEST_RUNNER}/endpoints_proto_datastore_test_runner.pyThis test runner assumes that you have App Engine SDK tools on your path
and will use the location of thedev_appserver.pyscript to
determine the location of the SDK. For example, on a Unix based system
it would be equivalent to:$dirname`readlink\`whichdev_appserver.py\``Contributing changesSeeCONTRIB.mdTo create docs for a contributed example, usepycco. For example:$pyccoexample_name/main.pyLicensingSeeLICENSENote: The test runner includes some code from the Twisted
project, which islisted under terms other than Apache 2.0.