Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python client: gce error on dev server #31

Closed
procedurallygenerated opened this issue Jan 3, 2014 · 7 comments
Closed

python client: gce error on dev server #31

procedurallygenerated opened this issue Jan 3, 2014 · 7 comments
Labels
type: question Request for information or clarification. Not an issue.

Comments

@procedurallygenerated
Copy link

I connect to the local version of my gcd using

datastore.set_options(dataset="datasetId", host="http://localhost:8888")
    try:
        # Create a RPC request to begin a new transaction.
        req = datastore.BeginTransactionRequest()
        # Execute the RPC synchronously.
        resp = datastore.begin_transaction(req)

On the last line it throws the error

File "/app/googledatastore/helper.py", line 70, in get_credentials_from_env
    credentials.refresh(http)
File "/app/oauth2client/client.py", line 516, in refresh
    self._refresh(http.request)
File "/app/oauth2client/gce.py", line 82, in _refresh
    response, content = http_request(uri)
File "/app/oauth2client/util.py", line 132, in positional_wrapper
    return wrapped(*args, **kwargs)
File "/app/oauth2client/client.py", line 475, in new_request
    self._refresh(request_orig)
File "/app/oauth2client/gce.py", line 82, in _refresh
    response, content = http_request(uri)
File "/app/httplib2/__init__.py", line 1570, in request
    (response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
File "/app/httplib2/__init__.py", line 1317, in _request
    (response, content) = self._conn_request(conn, request_uri, method, body, headers)
File "/app/httplib2/__init__.py", line 1286, in _conn_request
    response = conn.getresponse()
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/dist27/gae_override/httplib.py", line 510, in getresponse
    'An error occured while connecting to the server: %s' % e)
error: An error occured while connecting to the server: Unable to fetch URL: http://metadata.google.internal/0.1/meta-data/service-accounts/default/acquire?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdatastore%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email Error: [Errno 8] nodename nor servname provided, or not known

Looks like the request to refresh the gce credentials throws a unhandled exception that breaks the code.

I comment out line 70 in helper.py and raised an exception there to temp fix it and get it to work on my dev environment.

@proppy
Copy link
Contributor

proppy commented Jan 7, 2014

Are you running googledatastore inside App Engine?

In that case you might consider to use NDB if you want to access the datastore of your application using a higher level library.

@obeleh
Copy link

obeleh commented Jan 8, 2014

Huh, is it possible to connect with python googledatastore to an App Engine devellopment server?

Edit: I would greatly appreciate the possibility!

@proppy
Copy link
Contributor

proppy commented Jan 25, 2014

@obeleh that's basically what gcd.sh is doing, see https://developers.google.com/datastore/docs/tools/devserver

@obeleh
Copy link

obeleh commented Jan 25, 2014

I don't see how that enables me to use both App Engine NDB and google cloud datastore in the same testing environment.

@proppy
Copy link
Contributor

proppy commented Jan 25, 2014

@obeleh gcd.sh wraps the Java App Engine development server, so you can't currently share data between an App Engine Python development environment and a Cloud Datastore development environment: see #21.

@obeleh
Copy link

obeleh commented Jan 29, 2014

I understand. Sorry I was just hoping I missed something and that this functionality was released.

@meredithslota
Copy link

The link above redirects to https://cloud.google.com/datastore/docs/tools/datastore-emulator now. If you are still using the Python client, I might recommend you try https://github.com/googleapis/python-datastore for additional functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

5 participants