Ned Lowe
Ned Lowe

Reputation: 301

Connect GAE Remote API to dev_appserver.py

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

Upvotes: 1

Views: 349

Answers (1)

Dan Cornilescu
Dan Cornilescu

Reputation: 39834

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.

Upvotes: 2

Related Questions