scripts/interactive.py
author Matthew Wilkes <matthew@matthewwilkes.co.uk>
Fri, 15 May 2009 15:29:41 +0200
changeset 2314 0a0e603215d7
parent 2056 bbd16a156bde
child 2702 028f6adffde7
permissions -rwxr-xr-x
Include required antl3 library and check if datastore is available The datastore is checked for availability before requesting it to be cleared. This is because gaeftest uses its own method for ensuring no leakage of data by providing a temporary file as the backend. Reviewed by: Sverre Rabbelier
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2024
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     2
#
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     3
# Copyright 2009 the Melange authors.
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     4
#
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     8
#
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    10
#
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    15
# limitations under the License.
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    16
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    17
"""This module supplies an interactive shell with remote api configured.
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    18
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    19
Usage is simple:
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    20
2039
07f46319d24f Fix docstring in interactive.py script.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 2024
diff changeset
    21
App Engine interactive console
2024
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    22
>>> from soc.models.user import User
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    23
>>> gen = lambda: User.all()
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    24
>>> it = deepFetch(gen)
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    25
>>> result = [i for i in it]
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    26
"""
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    27
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    28
__authors__ = [
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    29
  '"Sverre Rabbelier" <sverre@rabbelier.nl>',
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    30
]
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    31
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    32
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    33
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    34
import code
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    35
import getpass
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    36
import os
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    37
import sys
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    38
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    39
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    40
def auth_func():
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    41
  """Returns a tuple with username and password.
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    42
  """
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    43
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    44
  return raw_input('Username:'), getpass.getpass('Password:')
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    45
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    46
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    47
def deepFetch(queryGen,key=None,batchSize = 100):
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    48
  """Iterator that yields an entity in batches.
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    49
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    50
  Args:
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    51
    queryGen: should return a Query object
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    52
    key: used to .filter() for __key__
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    53
    batchSize: how many entities to retrieve in one datastore call
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    54
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    55
  Retrieved from http://tinyurl.com/d887ll (AppEngine cookbook).
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    56
  """
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    57
2056
bbd16a156bde Print how many entities have been retrieved
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2046
diff changeset
    58
  from google.appengine.ext import db
bbd16a156bde Print how many entities have been retrieved
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2046
diff changeset
    59
2024
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    60
   # AppEngine will not fetch more than 1000 results
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    61
  batchSize = min(batchSize,1000)
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    62
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    63
  query = None
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    64
  done = False
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    65
  count = 0
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    66
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    67
  if key:
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    68
    key = db.Key(key)
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    69
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    70
  while not done:
2056
bbd16a156bde Print how many entities have been retrieved
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2046
diff changeset
    71
    print count
2024
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    72
    query = queryGen()
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    73
    if key:
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    74
      query.filter("__key__ > ",key)
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    75
    results = query.fetch(batchSize)
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    76
    for result in results:
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    77
      count += 1
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    78
      yield result
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    79
    if batchSize > len(results):
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    80
      done = True
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    81
    else:
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    82
      key = results[-1].key()
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    83
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    84
2046
1fb1c628ad60 Factor out the setup() method in interactive
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2039
diff changeset
    85
def remote(args, context=None):
2024
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    86
  """Starts a shell with the datastore as remote_api_stub.
2046
1fb1c628ad60 Factor out the setup() method in interactive
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2039
diff changeset
    87
1fb1c628ad60 Factor out the setup() method in interactive
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2039
diff changeset
    88
  Args:
1fb1c628ad60 Factor out the setup() method in interactive
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2039
diff changeset
    89
    args: arguments from the user
1fb1c628ad60 Factor out the setup() method in interactive
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2039
diff changeset
    90
    context: locals that should be added to the shell
2024
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    91
  """
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    92
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    93
  from google.appengine.ext import db
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    94
  from google.appengine.ext.remote_api import remote_api_stub
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    95
2046
1fb1c628ad60 Factor out the setup() method in interactive
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2039
diff changeset
    96
  if not context:
1fb1c628ad60 Factor out the setup() method in interactive
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2039
diff changeset
    97
    context = {}
1fb1c628ad60 Factor out the setup() method in interactive
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2039
diff changeset
    98
2024
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    99
  app_id = args[0]
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   100
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   101
  if len(args) > 1:
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   102
    host = args[1]
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   103
  else:
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   104
    host = '%s.appspot.com' % app_id
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   105
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   106
  remote_api_stub.ConfigureRemoteDatastore(app_id, '/remote_api', auth_func, host)
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   107
2046
1fb1c628ad60 Factor out the setup() method in interactive
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2039
diff changeset
   108
  context['deepFetch'] = deepFetch
2024
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   109
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   110
  code.interact('App Engine interactive console for %s' % (app_id,), None, context)
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   111
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   112
2046
1fb1c628ad60 Factor out the setup() method in interactive
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2039
diff changeset
   113
def setup():
2024
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   114
  """Sets up the sys.path and environment for development.
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   115
  """
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   116
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   117
  here = os.path.abspath(__file__)
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   118
  here = os.path.join(os.path.dirname(here), '..')
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   119
  here = os.path.normpath(here)
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   120
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   121
  appengine_location = os.path.join(here, 'thirdparty', 'google_appengine')
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   122
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   123
  extra_paths = [here,
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   124
                 os.path.join(appengine_location, 'lib', 'django'),
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   125
                 os.path.join(appengine_location, 'lib', 'webob'),
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   126
                 os.path.join(appengine_location, 'lib', 'yaml', 'lib'),
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   127
                 appengine_location,
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   128
                 os.path.join(here, 'app'),
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   129
                ]
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   130
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   131
  sys.path = extra_paths + sys.path
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   132
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   133
  os.environ['SERVER_SOFTWARE'] = 'Development Interactive Shell'
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   134
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   135
  import main as app_main
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   136
2046
1fb1c628ad60 Factor out the setup() method in interactive
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2039
diff changeset
   137
def main(args):
1fb1c628ad60 Factor out the setup() method in interactive
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2039
diff changeset
   138
  """Convenience wrapper that calls setup and remote.
1fb1c628ad60 Factor out the setup() method in interactive
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2039
diff changeset
   139
  """
1fb1c628ad60 Factor out the setup() method in interactive
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2039
diff changeset
   140
1fb1c628ad60 Factor out the setup() method in interactive
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2039
diff changeset
   141
  setup()
2024
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   142
  remote(args)
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   143
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   144
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   145
if __name__ == '__main__':
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   146
  if len(sys.argv) < 2:
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   147
    print "Usage: %s app_id [host]" % (sys.argv[0],)
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   148
    sys.exit(1)
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   149
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   150
  main(sys.argv[1:])