joycechen914 / Analyzing-US-Economic-Data-and-Building-a-Dashboard

Python Basics for Data Science Project
0 stars 8 forks source link

I have an error about this "resource.Bucket(name=bucket_name).put_object( Key = file_name, Body=f.read())" #1

Open xzodus01 opened 4 years ago

xzodus01 commented 4 years ago

I have an error about this "resource.Bucket(name=bucket_name).put_object( Key = file_name, Body=f.read())" image

angoro12 commented 1 year ago

Here is the solution:

Enable public access

From the IBM Cloud "console dashboard" , when you are loggin click here (https://cloud.ibm.com/), select Storage to view your resource list. Next, select the service instance with your bucket from within the Storage menu. This takes you to the Object Storage Console. Choose the bucket that you want to be publicly accessible. Keep in mind this policy makes all objects in a bucket available to download for anyone with the appropriate URL. Select Access policies from the navigation menu. Select the Public access tab. Click Create access policy. After you read the warning, choose Enable. Now all objects in this bucket are publicly accessible!

After you follow the instructions, replace again in the notebook with the most recent code that you can find in "Credentials" of Watson: credentials = { "apikey": "your-api-key", "cos_hmac_keys": { "access_key_id": "your-access-key-here", "secret_access_key": "your-secret-access-key-here" }, "endpoints": "your-endpoints", "iam_apikey_description": "your-iam_apikey_description", "iam_apikey_name": "your-iam_apikey_name", "iam_role_crn": "your-iam_apikey_name", "iam_serviceid_crn": "your-iam_serviceid_crn", "resource_instance_id": "your-resource_instance_id" }

Taken from https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-iam-public-access