in mns/account.py [0:0]
def set_client(self, host, access_id=None, access_key=None, security_token=None, credentials_provider=None):
""" 设置访问的url
@type host: string
@param host: 访问的url,例如:http://$accountid-new.mns.cn-hangzhou.aliyuncs.com
@type access_id: string
@param access_id: 用户的AccessId,阿里云官网获取
@type access_key: string
@param access_key: 用户的AccessKey,阿里云官网获取
@type security_token: string
@param security_token: 用户使用STS Token访问,需要提供security_token;如果不再使用 STS Token,请设置为 ""
@type credentials_provider: object
@param credentials_provider: 提供AK/STS Token的自定义对象, 可以使用alibabacloud_credentials提供的预定义provider
@note: Exception
:: MNSClientParameterException host格式错误
"""
if access_id is None:
access_id = self.access_id
if access_key is None:
access_key = self.access_key
if security_token is None:
security_token = self.security_token
if credentials_provider:
self.mns_client = MNSClient(host, logger=self.logger, credentials_provider=credentials_provider)
else:
self.mns_client = MNSClient(host, logger=self.logger, credentials_provider=StaticCredentialsProvider(access_id, access_key, security_token))