Skip to content

Instantly share code, notes, and snippets.

@lucemia
Created October 15, 2013 07:21
Show Gist options
  • Save lucemia/6987780 to your computer and use it in GitHub Desktop.
Save lucemia/6987780 to your computer and use it in GitHub Desktop.
要從 local 讀 datastore 的方式
import dev_appserver
dev_appserver.fix_sys_path()
def get_auth():
import getpass
return raw_input('Username:'), getpass.getpass('Password:')
def connect(app_id):
from google.appengine.ext.remote_api import remote_api_stub
from google.appengine.tools import appengine_rpc
host = "%s.appspot.com"%app_id
# https://groups.google.com/forum/?fromgroups=#!topic/google-appengine-python/LtAxeEjtlpk
# 'all HR apps have s~' in front of it
if app_id not in ('tagtoo2', 'tagtooads', 'tagtool', 'tagtootest', 'tagtoov1', 'tagtoozouber'):
app_id = "s~" + app_id
print app_id
# import pdb;pdb.set_trace()
remote_api_stub.ConfigureRemoteDatastore(app_id, '/_ah/remote_api', get_auth,
servername=host,
save_cookies=True,
secure=False,
rpc_server_factory=appengine_rpc.HttpRpcServer)
remote_api_stub.MaybeInvokeAuthentication()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment