Google Cloud Storage Python list_blob() not printing object list
<p>I am Python and Google Cloud Storage newbie.
I am writing a python script to get a file list from Google Cloud Storage bucket using Google Cloud Python Client Library and list_blobs() function from Bucket class is not working as I expected.</p>

<p><a href="https://googlecloudplatform.github.io/google-cloud-python/stable/storage-buckets.html" rel="nofollow">https://googlecloudplatform.github.io/google-cloud-python/stable/storage-buckets.html</a></p>

<p>Here is my python code:</p>

<pre><code>from google.cloud import storage
from google.cloud.storage import Blob

client = storage.Client.from_service_account_json(service_account_json_key_path, project_id)
bucket = client.get_bucket(bucket_id)
print(bucket.list_blobs())
</code></pre>

<p>If I understood the documentation correctly, print(bucket.list_blobs()) should print something like this: ['testfile.txt', 'testfile2.txt'].</p>

<p>However, my script printed this: 
"google.cloud.storage.bucket._BlobIterator object at 0x7fdfdbcac590"</p>

<p>delete_blob() documentation has example code same as mine.
<a href="https://googlecloudplatform.github.io/google-cloud-python/stable/storage-buckets.html" rel="nofollow">https://googlecloudplatform.github.io/google-cloud-python/stable/storage-buckets.html</a></p>

<p>I am not sure what I am doing wrong here.
Any pointers/examples/answers will be greatly appreciated. Thanks!</p>

<p>On <a href="https://webcache.googleusercontent.com/search?q=cache:9FyUQhlI9z8J:https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/storage/cloud-client/manage_blobs.py%20&amp;cd=3&amp;hl=en&amp;ct=clnk&amp;gl=be" rel="nofollow">this</a> page you can find some example functions. An example list function:</p>

<pre><code>def list_blobs(bucket_name):
    """Lists all the blobs in the bucket."""
    storage_client = storage.Client()
    bucket = storage_client.get_bucket(bucket_name)

    blobs = bucket.list_blobs()

    for blob in blobs:
        print(blob.name)
</code></pre>

<p>It contains a lot of other examples as well which you might find useful!</p>

python google-app-engine google-cloud-storage google-cloud-platform google-cloud-python