scripts/interactive.py
author Daniel Bentley <dbentley@google.com>
Wed, 01 Apr 2009 10:24:26 +0000
changeset 2048 236f37777764
parent 2046 1fb1c628ad60
child 2056 bbd16a156bde
permissions -rwxr-xr-x
A new model for seeding the database that makes it easier to seed many entities. new_seed_many is a function that seeds in a different way. Instead of using redirects, it figures out what the high-water mark of seeding is and proceeds from there. This is obviously a half-way step. I've talked about it with Sverre; I think I've mentioned it to others. If we like it, I volunteer to convert everything to this model (I think there will be savings and simplification when we're all the way). If we don't like it, I'll back out this code. But I'll also be sad, because this makes it a lot easier to add many entities (which I care about because I'm trying to fix list view for that many entities). Patch by: Dan Bentley
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
import sys
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
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    41
def auth_func():
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    42
  """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
    43
  """
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    44
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    45
  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
    46
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    47
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    48
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
    49
  """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
    50
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    51
  Args:
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    52
    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
    53
    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
    54
    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
    55
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    56
  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
    57
  """
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    58
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    59
   # 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
    60
  batchSize = min(batchSize,1000)
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    61
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    62
  query = None
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    63
  done = False
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    64
  count = 0
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    65
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    66
  if key:
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    67
    key = db.Key(key)
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    68
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    69
  while not done:
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    70
    query = queryGen()
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    71
    if key:
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    72
      query.filter("__key__ > ",key)
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    73
    results = query.fetch(batchSize)
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    74
    for result in results:
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    75
      count += 1
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    76
      yield result
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    77
    if batchSize > len(results):
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    78
      done = True
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    79
    else:
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    80
      key = results[-1].key()
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    81
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    82
2046
1fb1c628ad60 Factor out the setup() method in interactive
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2039
diff changeset
    83
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
    84
  """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
    85
1fb1c628ad60 Factor out the setup() method in interactive
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2039
diff changeset
    86
  Args:
1fb1c628ad60 Factor out the setup() method in interactive
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2039
diff changeset
    87
    args: arguments from the user
1fb1c628ad60 Factor out the setup() method in interactive
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2039
diff changeset
    88
    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
    89
  """
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    90
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    91
  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
    92
  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
    93
2046
1fb1c628ad60 Factor out the setup() method in interactive
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2039
diff changeset
    94
  if not context:
1fb1c628ad60 Factor out the setup() method in interactive
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2039
diff changeset
    95
    context = {}
1fb1c628ad60 Factor out the setup() method in interactive
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2039
diff changeset
    96
2024
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    97
  app_id = args[0]
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    98
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    99
  if len(args) > 1:
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   100
    host = args[1]
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   101
  else:
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   102
    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
   103
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   104
  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
   105
2046
1fb1c628ad60 Factor out the setup() method in interactive
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2039
diff changeset
   106
  context['deepFetch'] = deepFetch
2024
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   107
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   108
  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
   109
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   110
2046
1fb1c628ad60 Factor out the setup() method in interactive
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2039
diff changeset
   111
def setup():
2024
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   112
  """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
   113
  """
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   114
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   115
  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
   116
  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
   117
  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
   118
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   119
  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
   120
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   121
  extra_paths = [here,
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   122
                 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
   123
                 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
   124
                 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
   125
                 appengine_location,
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   126
                 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
   127
                ]
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   128
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   129
  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
   130
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   131
  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
   132
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   133
  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
   134
2046
1fb1c628ad60 Factor out the setup() method in interactive
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2039
diff changeset
   135
def main(args):
1fb1c628ad60 Factor out the setup() method in interactive
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2039
diff changeset
   136
  """Convenience wrapper that calls setup and remote.
1fb1c628ad60 Factor out the setup() method in interactive
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2039
diff changeset
   137
  """
1fb1c628ad60 Factor out the setup() method in interactive
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2039
diff changeset
   138
1fb1c628ad60 Factor out the setup() method in interactive
Sverre Rabbelier <srabbelier@gmail.com>
parents: 2039
diff changeset
   139
  setup()
2024
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   140
  remote(args)
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   141
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   142
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   143
if __name__ == '__main__':
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   144
  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
   145
    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
   146
    sys.exit(1)
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   147
43e5b515b71d Add a script to start an interactive shell with remote api
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   148
  main(sys.argv[1:])