create object with python ibm-cos-sdk get doesn't work












2














I need help... I can not access a bucket in my COS that I created with IBM Cloud dashboard from my notebook that I created in Watson Studio. Call this bucket3.



Initially I created a bucket2 from a single f2.zip (csv) file using IBM Watson 'Add Asset' and I am able to access the f2.zip. Call this bucket2.



The f2.zip was uploaded to bucket2 - later found out it was created on a previously COS storage; ie. asset created on IBM Cloud 'cloud-object-storage-nl'. Call this bucket1. I have a single Lite COS on IBM Cloud name = 'cloud-object-storage-xx'.



I can read the f2.zip and I am able to create a new f2.zip in bucket2 using the credential generated (cred_b2_editor) by the "Files UI" button.



IBM Cloud dashboard shows:



bucket1 us-geo Standard
bucket2 us-geo Standard
bucket3 us-east Standard


I am using the example from Creating a new text file in Using Python ibm-cos-sdk.



Fails with "ClientError: An error occurred (413) when calling the PutObject operation: Request Entity Too Large" on 2 cases:




  1. when I use endpoint_url = 'endpoints' form the bucket credentials generated by IBM Cloud) - ibm_api_key_id does not matter.


Succeeds: when I use endpoint_url = 'endpoint_url' form the watson credentials generated by Watson Studio... writes to bucket2 regardless of ibm_api_key_id (bucket2 or bucket3)



CODE:



# Point to generated credentials
credDict = dict(b2 = cred_b2_editor,
b3 = cred_b3_writer,
watson = cred_watson
)


bucketName = 'b3'
kwargs = dict(
ibm_api_key_id=credDict[bucketName]['ibm_api_key_id'],
ibm_service_instance_id=credDict[bucketName]['cred']['iam_serviceid_crn'], #COS_RESOURCE_CRN,
ibm_auth_endpoint=COS_AUTH_ENDPOINT,
config=Config(signature_version="oauth"),
endpoint_url=credDict[bucketName]['ep_private']
)
buckName = bucketDict[bucketName].split(':')[-1:][0]

print(buckName, kwargs['ibm_api_key_id'], kwargs['endpoint_url'])
cos = ibm_boto3.resource("s3", **kwargs)

#---> fix: bucketname needed to change with each bucket...
#---> fix: endpoint_url needs to point to private/public endpoint
cos.Object(buckName, csvBN.replace('.csv','.zip')).put(
Body=zbuf
)


Credentials Code - all of the following were generated



'''
Cloud Resource Name or 'bucket ID string'

The last field is the `bucketName`
'''
bucketDict = dict(b2 = 'crn:v1:bluemix:public:cloud-object-storage:global:a/<IDNum>:<serviceID-seperated>:bucket:bucket2',
b3 = 'crn:v1:bluemix:public:cloud-object-storage:global:a/<IDNum>:<serviceID-seperated>:bucket:bucket3'
)

# Bucket2 Editor credentials - created by IBM Watson automatically
cred_b2_editor = {
"apikey": "....",
"cos_hmac_keys": {
"access_key_id": "...",
"secret_access_key": "..."
},
"endpoints": "https://cos-service.bluemix.net/endpoints",
"iam_apikey_description": "Auto generated apikey during resource-key operation for Instance - crn:v1:bluemix:public:cloud-object-storage:global:a/<ServiceIDNum>:<COS_ID>::",
"iam_apikey_name": "auto-generated-apikey-<apikey_2>",
"iam_role_crn": "crn:v1:bluemix:public:iam::::serviceRole:Writer",
"iam_serviceid_crn": "crn:v1:bluemix:public:iam-identity::a/<ServiceIDNum>::serviceid:ServiceId-<serviceID_2>",
"resource_instance_id": "crn:v1:bluemix:public:cloud-object-storage:global:a/<ServiceIDNum>:<COS_ID>::"
}

## Bucket3 Create via IBM Cloud "New Credentials"
cred_b3_writer = {
"apikey": "4hEJq-slh28Atvq3XnekZ4YOl0yWiv4LbFigoPS3oiuL",
"endpoints": "https://cos-service.bluemix.net/endpoints",
"iam_apikey_description": "Auto generated apikey during resource-key operation for Instance - crn:v1:bluemix:public:cloud-object-storage:global:a/<ServiceIDNum>-<COS_ID>::",
"iam_apikey_name": "auto-generated-apikey-<apikey_3>",
"iam_role_crn": "crn:v1:bluemix:public:iam::::serviceRole:Writer",
"iam_serviceid_crn": "crn:v1:bluemix:public:iam-identity::a/<ServiceIDNum>::serviceid:ServiceId-<ServiceID_3>",
"resource_instance_id": "crn:v1:bluemix:public:cloud-object-storage:global:a/<ServiceIDNum>:<COS_ID>::"
}

# Created inside juptyer notebook 10/01 button
cred_b2_cos = dict(ibm_api_key_id=cred_b2['apikey'],
ibm_auth_endpoint="https://iam.ng.bluemix.net/oidc/token",
config=Config(signature_version='oauth'),
ep_private='https://s3-api.us-geo.objectstorage.service.networklayer.com',
ep_public = 'https://s3-api.us-geo.objectstorage.softlayer.net',
cred = cred_b2_editor
)
cred_b3_cos = dict(ibm_api_key_id=cred_b3['apikey'],
ibm_auth_endpoint="https://iam.ng.bluemix.net/oidc/token",
config=Config(signature_version='oauth'),
ep_private = 'https://s3.us-east.objectstorage.service.networklayer.com',
ep_public = 'https://s3.us-east.objectstorage.softlayer.net',
cred = cred_b3_writer
)









share|improve this question




















  • 1




    Discovered that I was not using the bucket3 private endpoint. Changed code to include the private endpoints for both bucket2 and bucket3. Now my error is : NoSuchKey: An error occurred (NoSuchKey) when calling the PutObject operation: The specified key does not exist.
    – frankr6591
    Nov 21 at 4:22


















2














I need help... I can not access a bucket in my COS that I created with IBM Cloud dashboard from my notebook that I created in Watson Studio. Call this bucket3.



Initially I created a bucket2 from a single f2.zip (csv) file using IBM Watson 'Add Asset' and I am able to access the f2.zip. Call this bucket2.



The f2.zip was uploaded to bucket2 - later found out it was created on a previously COS storage; ie. asset created on IBM Cloud 'cloud-object-storage-nl'. Call this bucket1. I have a single Lite COS on IBM Cloud name = 'cloud-object-storage-xx'.



I can read the f2.zip and I am able to create a new f2.zip in bucket2 using the credential generated (cred_b2_editor) by the "Files UI" button.



IBM Cloud dashboard shows:



bucket1 us-geo Standard
bucket2 us-geo Standard
bucket3 us-east Standard


I am using the example from Creating a new text file in Using Python ibm-cos-sdk.



Fails with "ClientError: An error occurred (413) when calling the PutObject operation: Request Entity Too Large" on 2 cases:




  1. when I use endpoint_url = 'endpoints' form the bucket credentials generated by IBM Cloud) - ibm_api_key_id does not matter.


Succeeds: when I use endpoint_url = 'endpoint_url' form the watson credentials generated by Watson Studio... writes to bucket2 regardless of ibm_api_key_id (bucket2 or bucket3)



CODE:



# Point to generated credentials
credDict = dict(b2 = cred_b2_editor,
b3 = cred_b3_writer,
watson = cred_watson
)


bucketName = 'b3'
kwargs = dict(
ibm_api_key_id=credDict[bucketName]['ibm_api_key_id'],
ibm_service_instance_id=credDict[bucketName]['cred']['iam_serviceid_crn'], #COS_RESOURCE_CRN,
ibm_auth_endpoint=COS_AUTH_ENDPOINT,
config=Config(signature_version="oauth"),
endpoint_url=credDict[bucketName]['ep_private']
)
buckName = bucketDict[bucketName].split(':')[-1:][0]

print(buckName, kwargs['ibm_api_key_id'], kwargs['endpoint_url'])
cos = ibm_boto3.resource("s3", **kwargs)

#---> fix: bucketname needed to change with each bucket...
#---> fix: endpoint_url needs to point to private/public endpoint
cos.Object(buckName, csvBN.replace('.csv','.zip')).put(
Body=zbuf
)


Credentials Code - all of the following were generated



'''
Cloud Resource Name or 'bucket ID string'

The last field is the `bucketName`
'''
bucketDict = dict(b2 = 'crn:v1:bluemix:public:cloud-object-storage:global:a/<IDNum>:<serviceID-seperated>:bucket:bucket2',
b3 = 'crn:v1:bluemix:public:cloud-object-storage:global:a/<IDNum>:<serviceID-seperated>:bucket:bucket3'
)

# Bucket2 Editor credentials - created by IBM Watson automatically
cred_b2_editor = {
"apikey": "....",
"cos_hmac_keys": {
"access_key_id": "...",
"secret_access_key": "..."
},
"endpoints": "https://cos-service.bluemix.net/endpoints",
"iam_apikey_description": "Auto generated apikey during resource-key operation for Instance - crn:v1:bluemix:public:cloud-object-storage:global:a/<ServiceIDNum>:<COS_ID>::",
"iam_apikey_name": "auto-generated-apikey-<apikey_2>",
"iam_role_crn": "crn:v1:bluemix:public:iam::::serviceRole:Writer",
"iam_serviceid_crn": "crn:v1:bluemix:public:iam-identity::a/<ServiceIDNum>::serviceid:ServiceId-<serviceID_2>",
"resource_instance_id": "crn:v1:bluemix:public:cloud-object-storage:global:a/<ServiceIDNum>:<COS_ID>::"
}

## Bucket3 Create via IBM Cloud "New Credentials"
cred_b3_writer = {
"apikey": "4hEJq-slh28Atvq3XnekZ4YOl0yWiv4LbFigoPS3oiuL",
"endpoints": "https://cos-service.bluemix.net/endpoints",
"iam_apikey_description": "Auto generated apikey during resource-key operation for Instance - crn:v1:bluemix:public:cloud-object-storage:global:a/<ServiceIDNum>-<COS_ID>::",
"iam_apikey_name": "auto-generated-apikey-<apikey_3>",
"iam_role_crn": "crn:v1:bluemix:public:iam::::serviceRole:Writer",
"iam_serviceid_crn": "crn:v1:bluemix:public:iam-identity::a/<ServiceIDNum>::serviceid:ServiceId-<ServiceID_3>",
"resource_instance_id": "crn:v1:bluemix:public:cloud-object-storage:global:a/<ServiceIDNum>:<COS_ID>::"
}

# Created inside juptyer notebook 10/01 button
cred_b2_cos = dict(ibm_api_key_id=cred_b2['apikey'],
ibm_auth_endpoint="https://iam.ng.bluemix.net/oidc/token",
config=Config(signature_version='oauth'),
ep_private='https://s3-api.us-geo.objectstorage.service.networklayer.com',
ep_public = 'https://s3-api.us-geo.objectstorage.softlayer.net',
cred = cred_b2_editor
)
cred_b3_cos = dict(ibm_api_key_id=cred_b3['apikey'],
ibm_auth_endpoint="https://iam.ng.bluemix.net/oidc/token",
config=Config(signature_version='oauth'),
ep_private = 'https://s3.us-east.objectstorage.service.networklayer.com',
ep_public = 'https://s3.us-east.objectstorage.softlayer.net',
cred = cred_b3_writer
)









share|improve this question




















  • 1




    Discovered that I was not using the bucket3 private endpoint. Changed code to include the private endpoints for both bucket2 and bucket3. Now my error is : NoSuchKey: An error occurred (NoSuchKey) when calling the PutObject operation: The specified key does not exist.
    – frankr6591
    Nov 21 at 4:22
















2












2








2







I need help... I can not access a bucket in my COS that I created with IBM Cloud dashboard from my notebook that I created in Watson Studio. Call this bucket3.



Initially I created a bucket2 from a single f2.zip (csv) file using IBM Watson 'Add Asset' and I am able to access the f2.zip. Call this bucket2.



The f2.zip was uploaded to bucket2 - later found out it was created on a previously COS storage; ie. asset created on IBM Cloud 'cloud-object-storage-nl'. Call this bucket1. I have a single Lite COS on IBM Cloud name = 'cloud-object-storage-xx'.



I can read the f2.zip and I am able to create a new f2.zip in bucket2 using the credential generated (cred_b2_editor) by the "Files UI" button.



IBM Cloud dashboard shows:



bucket1 us-geo Standard
bucket2 us-geo Standard
bucket3 us-east Standard


I am using the example from Creating a new text file in Using Python ibm-cos-sdk.



Fails with "ClientError: An error occurred (413) when calling the PutObject operation: Request Entity Too Large" on 2 cases:




  1. when I use endpoint_url = 'endpoints' form the bucket credentials generated by IBM Cloud) - ibm_api_key_id does not matter.


Succeeds: when I use endpoint_url = 'endpoint_url' form the watson credentials generated by Watson Studio... writes to bucket2 regardless of ibm_api_key_id (bucket2 or bucket3)



CODE:



# Point to generated credentials
credDict = dict(b2 = cred_b2_editor,
b3 = cred_b3_writer,
watson = cred_watson
)


bucketName = 'b3'
kwargs = dict(
ibm_api_key_id=credDict[bucketName]['ibm_api_key_id'],
ibm_service_instance_id=credDict[bucketName]['cred']['iam_serviceid_crn'], #COS_RESOURCE_CRN,
ibm_auth_endpoint=COS_AUTH_ENDPOINT,
config=Config(signature_version="oauth"),
endpoint_url=credDict[bucketName]['ep_private']
)
buckName = bucketDict[bucketName].split(':')[-1:][0]

print(buckName, kwargs['ibm_api_key_id'], kwargs['endpoint_url'])
cos = ibm_boto3.resource("s3", **kwargs)

#---> fix: bucketname needed to change with each bucket...
#---> fix: endpoint_url needs to point to private/public endpoint
cos.Object(buckName, csvBN.replace('.csv','.zip')).put(
Body=zbuf
)


Credentials Code - all of the following were generated



'''
Cloud Resource Name or 'bucket ID string'

The last field is the `bucketName`
'''
bucketDict = dict(b2 = 'crn:v1:bluemix:public:cloud-object-storage:global:a/<IDNum>:<serviceID-seperated>:bucket:bucket2',
b3 = 'crn:v1:bluemix:public:cloud-object-storage:global:a/<IDNum>:<serviceID-seperated>:bucket:bucket3'
)

# Bucket2 Editor credentials - created by IBM Watson automatically
cred_b2_editor = {
"apikey": "....",
"cos_hmac_keys": {
"access_key_id": "...",
"secret_access_key": "..."
},
"endpoints": "https://cos-service.bluemix.net/endpoints",
"iam_apikey_description": "Auto generated apikey during resource-key operation for Instance - crn:v1:bluemix:public:cloud-object-storage:global:a/<ServiceIDNum>:<COS_ID>::",
"iam_apikey_name": "auto-generated-apikey-<apikey_2>",
"iam_role_crn": "crn:v1:bluemix:public:iam::::serviceRole:Writer",
"iam_serviceid_crn": "crn:v1:bluemix:public:iam-identity::a/<ServiceIDNum>::serviceid:ServiceId-<serviceID_2>",
"resource_instance_id": "crn:v1:bluemix:public:cloud-object-storage:global:a/<ServiceIDNum>:<COS_ID>::"
}

## Bucket3 Create via IBM Cloud "New Credentials"
cred_b3_writer = {
"apikey": "4hEJq-slh28Atvq3XnekZ4YOl0yWiv4LbFigoPS3oiuL",
"endpoints": "https://cos-service.bluemix.net/endpoints",
"iam_apikey_description": "Auto generated apikey during resource-key operation for Instance - crn:v1:bluemix:public:cloud-object-storage:global:a/<ServiceIDNum>-<COS_ID>::",
"iam_apikey_name": "auto-generated-apikey-<apikey_3>",
"iam_role_crn": "crn:v1:bluemix:public:iam::::serviceRole:Writer",
"iam_serviceid_crn": "crn:v1:bluemix:public:iam-identity::a/<ServiceIDNum>::serviceid:ServiceId-<ServiceID_3>",
"resource_instance_id": "crn:v1:bluemix:public:cloud-object-storage:global:a/<ServiceIDNum>:<COS_ID>::"
}

# Created inside juptyer notebook 10/01 button
cred_b2_cos = dict(ibm_api_key_id=cred_b2['apikey'],
ibm_auth_endpoint="https://iam.ng.bluemix.net/oidc/token",
config=Config(signature_version='oauth'),
ep_private='https://s3-api.us-geo.objectstorage.service.networklayer.com',
ep_public = 'https://s3-api.us-geo.objectstorage.softlayer.net',
cred = cred_b2_editor
)
cred_b3_cos = dict(ibm_api_key_id=cred_b3['apikey'],
ibm_auth_endpoint="https://iam.ng.bluemix.net/oidc/token",
config=Config(signature_version='oauth'),
ep_private = 'https://s3.us-east.objectstorage.service.networklayer.com',
ep_public = 'https://s3.us-east.objectstorage.softlayer.net',
cred = cred_b3_writer
)









share|improve this question















I need help... I can not access a bucket in my COS that I created with IBM Cloud dashboard from my notebook that I created in Watson Studio. Call this bucket3.



Initially I created a bucket2 from a single f2.zip (csv) file using IBM Watson 'Add Asset' and I am able to access the f2.zip. Call this bucket2.



The f2.zip was uploaded to bucket2 - later found out it was created on a previously COS storage; ie. asset created on IBM Cloud 'cloud-object-storage-nl'. Call this bucket1. I have a single Lite COS on IBM Cloud name = 'cloud-object-storage-xx'.



I can read the f2.zip and I am able to create a new f2.zip in bucket2 using the credential generated (cred_b2_editor) by the "Files UI" button.



IBM Cloud dashboard shows:



bucket1 us-geo Standard
bucket2 us-geo Standard
bucket3 us-east Standard


I am using the example from Creating a new text file in Using Python ibm-cos-sdk.



Fails with "ClientError: An error occurred (413) when calling the PutObject operation: Request Entity Too Large" on 2 cases:




  1. when I use endpoint_url = 'endpoints' form the bucket credentials generated by IBM Cloud) - ibm_api_key_id does not matter.


Succeeds: when I use endpoint_url = 'endpoint_url' form the watson credentials generated by Watson Studio... writes to bucket2 regardless of ibm_api_key_id (bucket2 or bucket3)



CODE:



# Point to generated credentials
credDict = dict(b2 = cred_b2_editor,
b3 = cred_b3_writer,
watson = cred_watson
)


bucketName = 'b3'
kwargs = dict(
ibm_api_key_id=credDict[bucketName]['ibm_api_key_id'],
ibm_service_instance_id=credDict[bucketName]['cred']['iam_serviceid_crn'], #COS_RESOURCE_CRN,
ibm_auth_endpoint=COS_AUTH_ENDPOINT,
config=Config(signature_version="oauth"),
endpoint_url=credDict[bucketName]['ep_private']
)
buckName = bucketDict[bucketName].split(':')[-1:][0]

print(buckName, kwargs['ibm_api_key_id'], kwargs['endpoint_url'])
cos = ibm_boto3.resource("s3", **kwargs)

#---> fix: bucketname needed to change with each bucket...
#---> fix: endpoint_url needs to point to private/public endpoint
cos.Object(buckName, csvBN.replace('.csv','.zip')).put(
Body=zbuf
)


Credentials Code - all of the following were generated



'''
Cloud Resource Name or 'bucket ID string'

The last field is the `bucketName`
'''
bucketDict = dict(b2 = 'crn:v1:bluemix:public:cloud-object-storage:global:a/<IDNum>:<serviceID-seperated>:bucket:bucket2',
b3 = 'crn:v1:bluemix:public:cloud-object-storage:global:a/<IDNum>:<serviceID-seperated>:bucket:bucket3'
)

# Bucket2 Editor credentials - created by IBM Watson automatically
cred_b2_editor = {
"apikey": "....",
"cos_hmac_keys": {
"access_key_id": "...",
"secret_access_key": "..."
},
"endpoints": "https://cos-service.bluemix.net/endpoints",
"iam_apikey_description": "Auto generated apikey during resource-key operation for Instance - crn:v1:bluemix:public:cloud-object-storage:global:a/<ServiceIDNum>:<COS_ID>::",
"iam_apikey_name": "auto-generated-apikey-<apikey_2>",
"iam_role_crn": "crn:v1:bluemix:public:iam::::serviceRole:Writer",
"iam_serviceid_crn": "crn:v1:bluemix:public:iam-identity::a/<ServiceIDNum>::serviceid:ServiceId-<serviceID_2>",
"resource_instance_id": "crn:v1:bluemix:public:cloud-object-storage:global:a/<ServiceIDNum>:<COS_ID>::"
}

## Bucket3 Create via IBM Cloud "New Credentials"
cred_b3_writer = {
"apikey": "4hEJq-slh28Atvq3XnekZ4YOl0yWiv4LbFigoPS3oiuL",
"endpoints": "https://cos-service.bluemix.net/endpoints",
"iam_apikey_description": "Auto generated apikey during resource-key operation for Instance - crn:v1:bluemix:public:cloud-object-storage:global:a/<ServiceIDNum>-<COS_ID>::",
"iam_apikey_name": "auto-generated-apikey-<apikey_3>",
"iam_role_crn": "crn:v1:bluemix:public:iam::::serviceRole:Writer",
"iam_serviceid_crn": "crn:v1:bluemix:public:iam-identity::a/<ServiceIDNum>::serviceid:ServiceId-<ServiceID_3>",
"resource_instance_id": "crn:v1:bluemix:public:cloud-object-storage:global:a/<ServiceIDNum>:<COS_ID>::"
}

# Created inside juptyer notebook 10/01 button
cred_b2_cos = dict(ibm_api_key_id=cred_b2['apikey'],
ibm_auth_endpoint="https://iam.ng.bluemix.net/oidc/token",
config=Config(signature_version='oauth'),
ep_private='https://s3-api.us-geo.objectstorage.service.networklayer.com',
ep_public = 'https://s3-api.us-geo.objectstorage.softlayer.net',
cred = cred_b2_editor
)
cred_b3_cos = dict(ibm_api_key_id=cred_b3['apikey'],
ibm_auth_endpoint="https://iam.ng.bluemix.net/oidc/token",
config=Config(signature_version='oauth'),
ep_private = 'https://s3.us-east.objectstorage.service.networklayer.com',
ep_public = 'https://s3.us-east.objectstorage.softlayer.net',
cred = cred_b3_writer
)






python ibm-cloud cos watson-studio ibm-cloud-storage






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 at 5:49

























asked Nov 21 at 3:13









frankr6591

12418




12418








  • 1




    Discovered that I was not using the bucket3 private endpoint. Changed code to include the private endpoints for both bucket2 and bucket3. Now my error is : NoSuchKey: An error occurred (NoSuchKey) when calling the PutObject operation: The specified key does not exist.
    – frankr6591
    Nov 21 at 4:22
















  • 1




    Discovered that I was not using the bucket3 private endpoint. Changed code to include the private endpoints for both bucket2 and bucket3. Now my error is : NoSuchKey: An error occurred (NoSuchKey) when calling the PutObject operation: The specified key does not exist.
    – frankr6591
    Nov 21 at 4:22










1




1




Discovered that I was not using the bucket3 private endpoint. Changed code to include the private endpoints for both bucket2 and bucket3. Now my error is : NoSuchKey: An error occurred (NoSuchKey) when calling the PutObject operation: The specified key does not exist.
– frankr6591
Nov 21 at 4:22






Discovered that I was not using the bucket3 private endpoint. Changed code to include the private endpoints for both bucket2 and bucket3. Now my error is : NoSuchKey: An error occurred (NoSuchKey) when calling the PutObject operation: The specified key does not exist.
– frankr6591
Nov 21 at 4:22














1 Answer
1






active

oldest

votes


















2














The solution required:




  1. import bucket.configuration.CRN which has bucketname

  2. import a 'Writer' ServiceCredential, and

  3. setting the bucketName and corresponding kwargs when calling cos.Object().


Key was setting the bucket endpoint_url to the private/public endpoint for the respective bucket.



The code examples were corrected to reflect changes.






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53404771%2fcreate-object-with-python-ibm-cos-sdk-get-doesnt-work%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    The solution required:




    1. import bucket.configuration.CRN which has bucketname

    2. import a 'Writer' ServiceCredential, and

    3. setting the bucketName and corresponding kwargs when calling cos.Object().


    Key was setting the bucket endpoint_url to the private/public endpoint for the respective bucket.



    The code examples were corrected to reflect changes.






    share|improve this answer


























      2














      The solution required:




      1. import bucket.configuration.CRN which has bucketname

      2. import a 'Writer' ServiceCredential, and

      3. setting the bucketName and corresponding kwargs when calling cos.Object().


      Key was setting the bucket endpoint_url to the private/public endpoint for the respective bucket.



      The code examples were corrected to reflect changes.






      share|improve this answer
























        2












        2








        2






        The solution required:




        1. import bucket.configuration.CRN which has bucketname

        2. import a 'Writer' ServiceCredential, and

        3. setting the bucketName and corresponding kwargs when calling cos.Object().


        Key was setting the bucket endpoint_url to the private/public endpoint for the respective bucket.



        The code examples were corrected to reflect changes.






        share|improve this answer












        The solution required:




        1. import bucket.configuration.CRN which has bucketname

        2. import a 'Writer' ServiceCredential, and

        3. setting the bucketName and corresponding kwargs when calling cos.Object().


        Key was setting the bucket endpoint_url to the private/public endpoint for the respective bucket.



        The code examples were corrected to reflect changes.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 21 at 5:47









        frankr6591

        12418




        12418






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53404771%2fcreate-object-with-python-ibm-cos-sdk-get-doesnt-work%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            404 Error Contact Form 7 ajax form submitting

            How to know if a Active Directory user can login interactively

            Refactoring coordinates for Minecraft Pi buildings written in Python