Esempio n. 1
0
    def set_client(self,
                   host,
                   access_id=None,
                   access_key=None,
                   security_token=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,请设置为 ""

            @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
        self.mns_client = MNSClient(host,
                                    access_id,
                                    access_key,
                                    security_token=security_token,
                                    logger=self.logger)
Esempio n. 2
0
    def __init__(self,
                 host,
                 access_id,
                 access_key,
                 security_token="",
                 debug=False,
                 logger=None):
        """
            @type host: string
            @param host: 访问的url,例如:http://$accountid.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

            @note: Exception
            :: MNSClientParameterException host格式错误
        """
        self.access_id = access_id
        self.access_key = access_key
        self.security_token = security_token
        self.debug = debug
        self.logger = logger
        self.mns_client = MNSClient(host,
                                    access_id,
                                    access_key,
                                    security_token=security_token,
                                    logger=self.logger)
Esempio n. 3
0
    def set_client(self, host):
        """ 设置访问的url

            @type host: string
            @param host: 访问的url,例如:http://$accountid-new.mns.cn-hangzhou.aliyuncs.com

            @note: Exception
            :: MNSClientParameterException host格式错误
        """
        self.mns_client = MNSClient(host, self.access_id, self.access_key)
Esempio n. 4
0
    def __init__(self, host, access_id, access_key):
        """ 
            @type host: string
            @param host: 访问的url,例如:http://$accountid.mns.cn-hangzhou.aliyuncs.com

            @type access_id: string
            @param access_id: 用户的AccessId, 阿里云官网获取

            @type access_key: string
            @param access_key: 用户的AccessKey,阿里云官网获取

            @note: Exception
            :: MNSClientParameterException host格式错误
        """
        self.access_id = access_id
        self.access_key = access_key
        self.mns_client = MNSClient(host, access_id, access_key)
        self.debug = False