【发布时间】:2018-01-09 09:18:09
【问题描述】:
我正在尝试使用 python 访问我的 COS 服务。参考 IBM 的文档能够编写以下代码 sn-p
import ibm_boto3
from ibm_botocore.client import Config
api_key = 'key'
service_instance_id = 'resource-service-id'
auth_endpoint = 'http://iam.bluemix.net/'
service_endpoint = 'endpoint'
s3 = ibm_boto3.resource('s3',
ibm_api_key_id=api_key,
ibm_service_instance_id=service_instance_id,
ibm_auth_endpoint=auth_endpoint,
config=Config(signature_version='oauth'),
endpoint_url=service_endpoint)
s3.Bucket('bucket name').download_file('object name','location where the object must be saved')
这是正确的吗?此外,在尝试执行上述代码时,编译器无法从 auth_endpoint 检索身份验证令牌。我错过了什么吗?
请帮忙
提前致谢!
我将输出包括在内供您参考...
ibm_botocore.exceptions.CredentialRetrievalError: Error when retrieving credentials from https://iam.ng.bluemix.net/oidc/token: Retrieval of tokens from server failed
我正在使用 python 3.x
【问题讨论】: