Guest User

Untitled

a guest
May 27th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. # An interactive console for App Engine apps
  4. # Usage: ./appengine_console.py app_id [host]
  5.  
  6. import code
  7. import getpass
  8. import sys
  9.  
  10. sys.path.append("/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine")
  11. sys.path.append("/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/yaml/lib")
  12.  
  13. from google.appengine.ext.remote_api import remote_api_stub
  14. from google.appengine.ext import db
  15.  
  16. def auth_func():
  17. return raw_input('Username:'), getpass.getpass('Password:')
  18.  
  19. if len(sys.argv) < 2:
  20. print "Usage: %s app_id [host]" % (sys.argv[0],)
  21. app_id = sys.argv[1]
  22. if len(sys.argv) > 2:
  23. host = sys.argv[2]
  24. else:
  25. host = '%s.appspot.com' % app_id
  26.  
  27. remote_api_stub.ConfigureRemoteDatastore(app_id, '/remote_api', auth_func, host)
  28.  
  29. code.interact('App Engine interactive console for %s' % (app_id,), None, locals())
Add Comment
Please, Sign In to add comment