forked from lilydjwg/gaetalk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
remoteshell
executable file
·47 lines (36 loc) · 1.21 KB
/
remoteshell
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/python2
# vim:fileencoding=utf-8
import code
import getpass
import sys
sys.path.append('/opt/google-appengine/lib/yaml/lib')
sys.path.append('/opt/google-appengine/lib/fancy_urllib')
from google.appengine.ext.remote_api import remote_api_stub
from google.appengine.ext import db
from google.appengine.api import xmpp
def auth_func():
return raw_input('Username: '), getpass.getpass('Password: ')
if len(sys.argv) < 2:
print "Usage: %s app_id [host]" % (sys.argv[0],)
sys.exit(1)
app_id = sys.argv[1]
if len(sys.argv) > 2:
host = sys.argv[2]
else:
host = '%s.appspot.com' % app_id
remote_api_stub.ConfigureRemoteDatastore(app_id, '/remote_api', auth_func, host, secure=True)
import atexit
import readline
import rlcompleter # Tab 补全需要这个
import os
readline.parse_and_bind('tab: complete')
historyPath = ".gaehistory"
def save_history(historyPath=historyPath):
import readline
readline.write_history_file(historyPath)
if os.path.exists(historyPath):
readline.read_history_file(historyPath)
readline.set_history_length(1000)
atexit.register(save_history)
del atexit, readline, save_history, historyPath
code.interact('App Engine interactive console for %s' % (app_id,), None, locals())