def init_remote_api(app_id): from remote_api_shell import fix_sys_path fix_sys_path() from google.appengine.ext.remote_api import remote_api_stub login = lambda: (app_engine_username, app_engine_password) remote_api_stub.ConfigureRemoteApi(None, '/_ah/remote_api', login, '%s.appspot.com' % app_id)
import cgi import os import urllib2 import urlparse # This isn't needed if running from runtests.py, which it probably # is, but is useful if running by hand. if False: # remote_api_shell has a fix-paths-for-appengine function, and # it's easy to find because it lives on $PATH (though not # necessarily $PYTHONPATH). Note this changes $PYTHONPATH: import os import sys sys.path.extend([''] + os.environ.get('PATH', '').split(':')) import remote_api_shell remote_api_shell.fix_sys_path(include_google_sql_libs=False) os.environ['SERVER_SOFTWARE'] = 'Development (oauth-test remote-api)/1.0' from google.appengine.ext.remote_api import remote_api_stub from oauth_provider import consts from oauth_provider import models_oauth from oauth_provider import oauth import user_models def _stub_appengine_for_dev_appserver(dev_appserver_url): """Use remote_api_stub to set up a user account, consumer key, etc. remote_api_stub (which is part of appengine), stubs out all appengine calls so they go to the remote server (dev_appserver_url).
#!/usr/bin/env python # Need to import and fix the sys path before importing other things. import remote_api_shell remote_api_shell.fix_sys_path() import time from google.appengine.api import datastore_admin from google.appengine.ext.remote_api import remote_api_stub from google.appengine.tools import appengine_rpc def configure_remote_api(): def auth_func(): return ('*****@*****.**', 'pyluojtwiazmklmq') remote_api_stub.ConfigureRemoteApi( 'edufocal-app', '/_ah/remote_api', auth_func, servername='edufocal-app.appspot.com', save_cookies=True, secure=False, rpc_server_factory=appengine_rpc.HttpRpcServer) remote_api_stub.MaybeInvokeAuthentication() def main(): print 'Checking indexes...'
#!/usr/bin/env python # Need to import and fix the sys path before importing other things. import remote_api_shell remote_api_shell.fix_sys_path() import time from google.appengine.api import datastore_admin from google.appengine.ext.remote_api import remote_api_stub from google.appengine.tools import appengine_rpc def configure_remote_api(): def auth_func(): return ('*****@*****.**', 'pyluojtwiazmklmq') remote_api_stub.ConfigureRemoteApi( 'edufocal-app', '/_ah/remote_api', auth_func, servername='edufocal-app.appspot.com', save_cookies=True, secure=False, rpc_server_factory=appengine_rpc.HttpRpcServer) remote_api_stub.MaybeInvokeAuthentication() def main(): print 'Checking indexes...' configure_remote_api() interval = 10 # seconds.