I have a VM instance (Ubuntu 14.04) in the Google Cloud Platform where I'm doing tests with the Google Cloud Storage. What I want to do is to create a simple script that uses Cloud Storage Python Client Library. This script has to list the content of an existing bucket. Here is my script:
import logging
import os
import cloudstorage as gcs
from google.appengine.api import app_identity
# Retry can help overcome transient urlfetch or GCS issues, such as timeouts.
my_default_retry_params = gcs.RetryParams(initial_delay=0.2,
max_delay=5.0,
backoff_factor=2,
max_retry_period=15)
gcs.set_default_retry_params(my_default_retry_params)
stats = gcs.listbucket('/niksa')
for f in stats:
print f
I have installed cloudstorage Python module as shown in HERE. Then I updated the PYTHONPATH env variable to include the module. When running the script for the first time the script complained for missing module
ImportError: No module named google.appengine.api
To solve this, I installed Google App Engine by using the following command:
curl https://sdk.cloud.google.com/ | bash
gcloud components update gae-python
And then I updated the PYTHONPATH in my .bashrc to point to the parent folder containing the google python module.
When running once again the script, I got the following error:
AssertionError: No api proxy found for service "memcache"
My question is: Do I miss any other module/service needed? From the materials and documents I found, nothing has been mentioned. Note that gsutil (the command line tool) works as expected.