1

I want to execute a Python script that connects to my local dev_appserver.py instance to run some DataStore queries.

The dev_appserver.py is running with:

builtins:
- remote_api: on

As per https://cloud.google.com/appengine/docs/python/tools/remoteapi I have:

remote_api_stub.ConfigureRemoteApiForOAuth(
    hostname,
    '/_ah/remote_api'
)

In the Python script, but what should the hostname be set to?

For example, when dev_appserver.py started, it prints:

INFO     2016-10-18 12:02:16,850 api_server.py:205] Starting API server at: http://localhost:56700

But I set the value to localhost:56700, I get the following error:

httplib2.SSLHandshakeError: [SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:590)

(Same error for any port that has anything running on it - e.g. 8000, 8080, etc).

If anyone has managed to get this to run successfully, what hostname did you use?

Many thanks, Ned

Ned Lowe
  • 301
  • 1
  • 13

1 Answers1

2

The dev_appserver.py doesn't support SSL (I can't find the doc reference anymore), so it can't answer https:// requests.

You could try using http-only URLs (not sure if possible with the remote API - I didn't use it yet, may need to disable handler secure option in app.yaml config files).

At least on my devserver I am able to direct my browser to the http-only API server URL reported by devserver.py at startup and I see {app_id: dev~my_app_name, rtok: '0'}.

Or you could setup a proxy server, see GAE dev_appserver.py over HTTPS.

Community
  • 1
  • 1
Dan Cornilescu
  • 39,470
  • 12
  • 57
  • 97
  • You were 99% there and gave me what I needed to figure out the final 1%, so I'll mark as Answer. For anyone reading this - the answer is to use the "API Server" host (so localhost:56700 for above) and then add "secure=False" to the remote_api_stub call. remote_api_stub.ConfigureRemoteApiForOAuth( 'localhost:56700', '/_ah/remote_api', secure=False ) – Ned Lowe Oct 19 '16 at 00:46