Search code examples
pythonibm-cloud

How to get all files from a Bucket - IBM Cloud Object Storage?


I want to get all files that are in my bucket with python. I trying this way:

import ibm_boto3
from ibm_botocore.client import Config, ClientError

files = cos.Object(my_bucket_name).objects.all() # error here

But it shows this error:

ValueError       (note: full exception trace is shown but execution is paused at: <module>)
Required parameter key not set

How do I get all objects/files from the bucket?


Solution

  • Sorry, I was doing it wrong, the correct way is like this:

    files = cos.Bucket(bucket_name).objects.all()
    

    Problem solved!