Google App Engine Bulkloader Refreshing due to a 401 Loop
Developing apps on Google App Engine can be difficult when your production servers have a dataset that is hard to reproduce on your local development servers. Thankfully Google App Engine includes a very useful tool to do bulkloading.
To download your data from production:
appcfg.py download_data --url=http://{APPID}.appspot.com/_ah/remote_api --filename=data.sqlite --batch_size=500 --kind={ENTITYTYPE}
To upload your data into local development:
appcfg.py upload_data --url=http://localhost:8080/_ah/remote_api --filename=data.sqlite --batch_size=500
Unfortunately if you are updating to the latest version of Google App Engine Launcher, it has recently stopped working. The download works fine with the new OAuth2 defaults on production but when you go to upload your dataset, it will give the following errors:
2015-11-17 22:16:19,421 INFO client.py:797 Refreshing access_token
2015-11-17 22:16:19,526 INFO client.py:571 Refreshing due to a 401 (attempt 2/2)
2015-11-17 22:16:19,526 INFO client.py:797 Refreshing access_token
2015-11-17 22:16:19,621 INFO client.py:571 Refreshing due to a 401 (attempt 2/2)
2015-11-17 22:16:19,621 INFO client.py:797 Refreshing access_token
2015-11-17 22:16:19,718 INFO client.py:571 Refreshing due to a 401 (attempt 1/2)
2015-11-17 22:16:19,718 INFO client.py:797 Refreshing access_token
2015-11-17 22:16:19,811 INFO client.py:571 Refreshing due to a 401 (attempt 2/2)
2015-11-17 22:16:19,811 INFO client.py:797 Refreshing access_token
Error 401: --- begin server output ---
You must be logged in as an administrator to access this.
Solution
Download a previous version of GAE from this link to do the upload:
https://console.developers.google.com/storage/browser/appengine-sdks/deprecated/190/
Ilya ( )
i was able to fix this in the newest version of the AE SDK + gcloud using this command:
gcloud auth application-default login