I try to use list_object_v2 to list files in bucket on digitalocean but it's not working. The Upload and Delete file function is working normally with the endpoint, access key, and bucket. The problem is I try to list every file name inside the bucket and it's not working. (I'm kind of sure my endpoint and everything are correct)
Thank you
self.s3 = boto3.client("s3", region_name="sgp1", endpoint_url=self.space_endpoint, aws_access_key_id=self.aws_access_key, aws_secret_access_key=self.aws_secret_access_key, config=Config(signature_version="s3v4"), )def digitalOcean_update(self, status, filepath): filename = os.path.basename(filepath) if status == 0: try: self.s3.delete_object(Bucket=self.space_bucket, Key=filename) except Exception as e: return -1 elif status == 1: try: self.s3.upload_file( filepath, self.space_bucket, filename, ) except Exception as e: return -2 elif status == 2: try: response = self.s3.list_objects_v2(Bucket=self.space_bucket) print(response) except Exception as e: print(f"Error downloading files: {e}") return -1 return 0