-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
The docs in this link do not make it clear on how to use the library against the local emulator, with out any creds needed. https://cloud.google.com/datastore/docs/datastore-api-tutorial
The service object can be instantiated without creds for emulator use:
c = datastore.Client(project='test', http=httplib2.Http())
The lib I assume requires the latest version of the emulator to work, it should be noted somewhere in the docs too, I did a "gcloud components install gcd-emulator" to get the latest version.
Lastly, with all the above in place, the lib does not work with the emulator, it calls a url that the emulator does not recognise and therefore complains. I had to make this adjustment to have the lib and emulator working together:
Change https://github.com/GoogleCloudPlatform/gcloud-python/blob/master/gcloud/datastore/connection.py line 49
from:
API_URL_TEMPLATE = ('{api_base}/{api_version}/projects'
to:
API_URL_TEMPLATE = ('{api_base}/datastore/{api_version}/projects'
With this change, the library and latest emulator worked together without creds, as expected.
I am not sure if this is a general issue with the lib, or if I am using it incorrectly to need this, or if the emulator is the issue and it should be fixed there?