Skip to content

Instantly share code, notes, and snippets.

@linar-jether
Created September 10, 2015 15:15
Show Gist options
  • Save linar-jether/a843394afe39b51f3f46 to your computer and use it in GitHub Desktop.
Save linar-jether/a843394afe39b51f3f46 to your computer and use it in GitHub Desktop.
Use App Engine services using the remote_api, works locally and in ipython shell
import getpass
import sys
sys.path.insert(0,r"C:\Program Files (x86)\Google\google_appengine")
sys.path.insert(0,r"C:\Program Files (x86)\Google\google_appengine\lib\yaml\lib")
sys.path.insert(0,r"C:\Program Files (x86)\Google\google_appengine\lib\fancy_urllib")
from google.appengine.ext.remote_api import remote_api_stub
from google.appengine.ext import db
app_id = 'your-app-id'
host = '%s.appspot.com' % app_id
remote_api_stub.ConfigureRemoteApiForOAuth(host,
'/_ah/remote_api', True)
@mikelambert
Copy link

This works for you as of Sept 10th? The documentation at https://cloud.google.com/appengine/docs/python/tools/remoteapi mentions what you have above, but I don't see a ConfigureRemoteApiForOAuth in remote_api_stub.py (or anywhere). The only functions I see are:
ConfigureRemoteApiFromServer
ConfigureRemoteApi (aka ConfigureRemoteDatastore)
_ConfigureRemoteApiWithComputeEngineCredential (calls _ConfigureRemoteApiWithOAuthCredentials)
_ConfigureRemoteApiWithKeyFile (calls _ConfigureRemoteApiWithOAuthCredentials)

I'm trying to get the _ConfigureRemoteApi functions working, but no luck yet...they seem entirely unused/untested.

I'm running on a Mac, not a PC, but I have trouble believing the files would differ by platform...does your remote_api_stub.py contain a ConfigureRemoteApiForOAuth?

@linar-jether
Copy link
Author

Yep, still works.
I tried the other ConfigureRemoteApi methods and couldn't get them to work... seems google has abandoned the remote api (Even after i managed to authenticate there are many other problems).
But maybe an outdated version? or the mac version missed an update?
The most recent version listed here (google_appengine_1.9.26.zip)
contains ConfigureRemoteApiForOAuth in remote_api_stub.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment