|
40 | 40 | class CosConfig(object): |
41 | 41 | """config类,保存用户相关信息""" |
42 | 42 |
|
43 | | - def __init__(self, Appid=None, Region=None, SecretId=None, SecretKey=None, Token=None, Scheme=None, Timeout=None, |
| 43 | + def __init__(self, Appid=None, Region=None, SecretId=None, SecretKey=None, Token=None, CredentialInstance=None, Scheme=None, Timeout=None, |
44 | 44 | Access_id=None, Access_key=None, Secret_id=None, Secret_key=None, Endpoint=None, IP=None, Port=None, |
45 | 45 | Anonymous=None, UA=None, Proxies=None, Domain=None, ServiceDomain=None, PoolConnections=10, |
46 | 46 | PoolMaxSize=10, AllowRedirects=False, SignHost=True, EndpointCi=None, EndpointPic=None, EnableOldDomain=True, EnableInternalDomain=True): |
@@ -119,9 +119,14 @@ def __init__(self, Appid=None, Region=None, SecretId=None, SecretKey=None, Token |
119 | 119 | elif (Access_id and Access_key): |
120 | 120 | self._secret_id = self.convert_secret_value(Access_id) |
121 | 121 | self._secret_key = self.convert_secret_value(Access_key) |
| 122 | + elif (CredentialInstance and hasattr(CredentialInstance, "secret_id") and hasattr(CredentialInstance, "secret_key") and hasattr(CredentialInstance, "token")): |
| 123 | + self._secret_id = None |
| 124 | + self._secret_key = None |
| 125 | + self._credential_inst = CredentialInstance |
122 | 126 | elif self._anonymous: |
123 | 127 | self._secret_id = None |
124 | 128 | self._secret_key = None |
| 129 | + self._credential_inst = None |
125 | 130 | else: |
126 | 131 | raise CosClientError('SecretId and SecretKey is Required!') |
127 | 132 |
|
|
0 commit comments