0

所以我试图将文件上传到我的存储桶。这是它的代码:-

import ibm_boto3
from ibm_botocore.client import Config

cos = ibm_boto3.client(service_name='s3',use_ssl=False,verify=False,
                       ibm_api_key_id='secret',
                       ibm_service_instance_id='secret',
                       config=Config(signature_version='oauth'),
                       endpoint_url='https://control.cloud-object-storage.cloud.ibm.com/v2/endpoints')

try:
    res = cos.upload_file('C:/Users/avinamishra/Pictures/green.jpg','avi-test-bucket', 'green.jpg')
except Exception as e:
    print(Exception, e)
else:
    print('File Uploaded')

错误:<class 'Exception'> 从https://iam.cloud.ibm.com/identity/token检索凭证时出错:HttpCode(400) - 从服务器检索令牌失败。【8.5s完成】

从这里使用文档 - https://cloud.ibm.com/docs/cloud-object-storage/libraries?topic=cloud-object-storage-python

文档可能已过时或我不知道。有人知道吗?

4

0 回答 0