I had the same problem and just got it to work.

As the OP mentioned, I could not manage to get it to work following the 
steps suggested by the appcfg.py error message 
(*oauth2client.client.ApplicationDefaultCredentialsError: 
The Application Default Credentials are not available. They are available 
if running in Google Compute Engine. Otherwise, the environment variable 
GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining 
the credentials. 
See https://developers.google.com/accounts/docs/application-default-credentials 
<https://developers.google.com/accounts/docs/application-default-credentials> 
for 
more information.*)

Getting the key by those instructions did not work (I tried the app engine 
key when prompted to select whether I wanted compute engine or app engine 
key, maybe I chose wrong).

I wrote the solution up as a blogspot with the relevant screenshot here: 
Backing 
up data from App Engine with appcfg.py 
<http://www.bemmu.com/how-to-backup-data-from-app-engine>

Anyway, steps I followed to get it to work:

   1. Go to IAM <https://console.cloud.google.com/iam-admin>
   2. Click the three balls on the right side of "Compute Engine default 
   service account"
   3. "Create key"
   4. JSON
   5. Save the key compute-key.json

Then create a script called "backup":
GOOGLE_APPLICATION_CREDENTIALS=compute-key.json appcfg.py download_data . 
--filename=data_store_backup

Instead of . you can also put the full path to the directory containing 
app.yaml if running from somewhere else.

If you run into "HTTPError: HTTP Error 404: Not Found" when doing 
download_data, your appcfg.py is so old that is hitting a deprecated 
endpoint. Update your appcfg.py and try again.

On Monday, April 18, 2016 at 2:34:43 AM UTC+9, solsTiCe d'Hiver wrote:
>
> hi.
> Like I used to do it several years ago, I am attempting to *bulk download* 
> the *entities* of the datastore of my app with *appcfg.py* (from latest 
> python SDK)
>
> I am using this little script:
> #!/bin/bash
> date=`date +%Y%m%d`
> appid=myappid
> url="https://$appid.appspot.com/_ah/remote_api";
> GOOGLE_APPLICATION_CREDENTIALS=myapp.json appcfg.py download_data -v -e 
> myem...@gmail.com --application=s~$appid --url=$url --filename=allentities
> -$date.sql3
> rm -f bulkloader-*
>
>
> because this command does not ask for an oauth token, I have previously 
> run the command
>
> appcfg.py list_versions
>
> just to get the *oauth2* token
> And as said in 
> https://developers.google.com/accounts/docs/application-default-credentials 
> I have generated a *json* file with the google credentials and use it 
> with GOOGLE_APPLICATION_CREDENTIALS variable as shown above.
>
> However when I run the script I get a long list of
> 2016-04-17 19:21:29,316 INFO client.py:546 Attempting refresh to obtain 
> initial access_token 
> 2016-04-17 19:21:29,378 INFO client.py:804 Refreshing access_token 
> 2016-04-17 19:21:30,901 INFO client.py:578 Refreshing due to a 401 
> (attempt 1/2) 
> 2016-04-17 19:21:30,988 INFO client.py:804 Refreshing access_token
> 2016-04-17 19:21:31,570 INFO client.py:578 Refreshing due to a 401 
> (attempt 2/2) 
> 2016-04-17 19:21:31,659 INFO client.py:804 Refreshing access_token 
> 2016-04-17 19:21:32,436 INFO client.py:578 Refreshing due to a 401 
> (attempt 1/2) 
> 2016-04-17 19:21:32,526 INFO client.py:804 Refreshing access_token 
> 2016-04-17 19:21:33,162 INFO client.py:578 Refreshing due to a 401 
> (attempt 2/2) 
> [...]
>
>
> and this ends with 
> Error 401: --- begin server output ---
> You must be logged in as an administrator to access this.
> --- end server output ---
>
> I have the same 401 error in the log of my app.
>
> What could be wrong ?
> I am the owner of the app and my email is listed as such in the logins
>
> I don't want to enable billing and use the Google Cloud Platform to export 
> entities from the datastore with "Admin Datastore" (by the way clicking the 
> button "Open Admin Datastore" does nothing, one need to use a right click 
> and open in new tab to get something)
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/781611b0-7085-42d6-9146-180bae943a27%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to