25

I'm using the Google App Engine Launcher to deploy my app to the GAE servers. Is there a way to save my user account and password so I don't have to type it in every time I redeploy?

I'm still in the learning stages of using GAE so typing my 16 odd character password gets tiresome when I redeploy 15+ times per evening.

alex
  • 479,566
  • 201
  • 878
  • 984
Ken
  • 1,110
  • 2
  • 10
  • 26
  • Maybe you have a reason to deploy but there is a local server with the SDK. – ide Mar 01 '11 at 02:46
  • I redeploy to work with my live data. I'm the only one who uses the app so I'm not really risking a lot by working on the live version. =) – Ken Mar 01 '11 at 02:54
  • OT FYI: You can download your live data to your development server with the python bulkloader tool. It works even with Java. – Riley Lark Mar 01 '11 at 02:58
  • I use AutoIT and it works very good. The solution is here: http://stackoverflow.com/questions/17527767/scripting-gae-launcher-with-autoit – Niklas Rosencrantz Jul 08 '13 at 15:17

9 Answers9

21

You can make a .bat file that has the following text:

echo <password> | c:\python25\python.exe "C:\Program Files\Google\google_appengine\appcfg.py" --email=username --passin update <directory of app on your pc>

(According to GAE docs you cannot specify the password as a command line option)

Uri
  • 25,622
  • 10
  • 45
  • 72
17

Use oauth to save an OAuth2 token so you don't need to keep re-typing your password.

Stuart Langley
  • 7,044
  • 1
  • 20
  • 20
  • I changed the answer to this because oauth is (two years later) the preferred method currently. Oauth + a bat file to upload works great. – Ken Jul 16 '13 at 19:43
  • 1
    This answer lacks practical advice on how to use OAuth with GAE – David Yell Mar 05 '15 at 10:59
  • The oauth instructions are in the section: https://cloud.google.com/appengine/docs/python/tools/uploadinganapp#Python_Password-less_login_with_OAuth2 – Jerry101 Mar 27 '15 at 23:44
7

The accepted solution didn't work for me. Using pipes did

echo <password> | c:\python25\python.exe "C:\Program Files\Google\google_appengine\appcfg.py" --email=username --passin update <directory of app on your pc>
Tobias
  • 4,999
  • 7
  • 34
  • 40
3

Other tips & trick: using command line as below:

To get appcfg.py to accept --password on the command line instead of being prompted for it:

Change: *appengine/google_appengine/google/appengine/tools/appcfg.py*

add the following in the parser.add_option section:

parser.add_option("-p","--password", action="store", dest="password",
                  metavar="PASSWORD", default=None,
                  help="The password")

Then modify the GetUserCredentials function:

def GetUserCredentials():
  """Prompts the user for a username and password."""
  email = self.options.email
  if email is None:
    email = self.raw_input_fn("Email: ")

  password = self.options.password
  if password is None:
    password = self.raw_input_fn("Password: ")

#      password_prompt = "Password for %s: " % email
#      if self.options.passin:
#        password = self.raw_input_fn(password_prompt)
#      else:
#        password = self.password_input_fn(password_prompt)

  return (email, password)

That's it, now you can call:

appcfg.py update demos/guestbook --email=email@gmail.com --password=xxxx

Ref: http://samalolo.blogspot.com/2009/04/appcfgpy-tweak-to-allow-passing.html

Bao Le
  • 16,643
  • 9
  • 65
  • 68
3

I just wanted to say thank you to Friar Broccoli, it's exactly what I was looking for. To clarify for other beginners like myself, my final batch file ended up looking like the following,

c:\python27\pythonw.exe "C:\Program Files (x86)\Google\google_appengine\appcfg.py" --oauth2 update "C:\Users\[username]\[directory]\app.yaml"

Worked perfectly, wish this solution was higher up.

Mike
  • 247
  • 2
  • 5
  • 10
  • You're a beginner so I'm assuming you've done research into this, but is there a good public demo project for GAE that isn't horribly outdated and also includes things like bat files for uploads? If there isn't then I'll make one. – Ken Nov 17 '14 at 23:00
3

appcfg already does this for you. Per the docs:

appcfg.py gets the application ID from the app.yaml file, and prompts you for the email address and password of your Google account. After successfully signing in with your account, appcfg.py stores a "cookie" so that it does not need to prompt for a password on subsequent attempts.

If this isn't occurring for you, you might want to try deleting any .appcfg* config files.

Nick Johnson
  • 100,655
  • 16
  • 128
  • 198
2

For windows 7, .appcfg_cookies under C:\Users\username\.appcfg_cookies

Rozi
  • 65
  • 5
1

It's amazingly simple. Just put this in a batch file:

appcfg.py --oauth2  update  "X:\local\path\to\your\app.yaml\file" 

The first time you run it google will authenticate, after that it's all automatic.

1

You could write a command line script that executes appcfg.py to do this.

You can specify the email to use with the --email= command line parameter.

You can pass in the password from stdin by using the --passin parameter.

Calvin
  • 4,177
  • 1
  • 16
  • 17