0

I have some entities added on datastore - made a little web app (in Python) to read and write from the datastore through endpoints. I am able to use the webapp through endpoints from javascript. I want to access the web app from an installed application on PC. Is there a way to access endpoints from installed applications written in Python? How?

Is there any other way to access the datastore from PC installed applications written in Python?

Dan McGrath
  • 41,220
  • 11
  • 99
  • 130
Sungineer
  • 23
  • 5
  • Have a look at the remote_api we used it inside plone to author content and the publish to appengine. Plone used the remote_api to update/create content. – Tim Hoffman Nov 02 '15 at 10:44

1 Answers1

1

That's one of the beauties of AppEngine's endpoints. You should use the Python Client Library for Google's APIs to communicate with your endpoints

pip install --upgrade google-api-python-client

Then you'll construct a resource object to communicate with your api using the apiclient.discovery.build function. For eg:

from apiclient.discovery import build


api_root = 'https://<APP_ID>.appspot.com/_ah/api'
api = 'api_name'
version = 'api_version'
discovery_url = '%s/discovery/v1/apis/%s/%s/rest' % (api_root, api, version)
service = build(api, version, discoveryServiceUrl=discovery_url)

You can then perform operations at service.<endpoint_method> etc

A more complete example with authentication can be found here.


EDIT:

Or as @Zig recommends, directly use the Google Cloud API

pip install googledatastore

Trivial example

Jeffrey Godwyll
  • 3,787
  • 3
  • 26
  • 37