How to use the aliyun-python-sdk-core-v3.aliyunsdkcore.auth.Signer.GetSessionAkRequest function in aliyun-python-sdk-core-v3

To help you get started, we’ve selected a few aliyun-python-sdk-core-v3 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aliyun / aliyun-openapi-python-sdk / aliyun-python-sdk-core-v3 / aliyunsdkcore / auth / Signer.py View on Github external
def _get_session_ak_and_sk(self):

        request = GetSessionAkRequest()
        request.set_method("GET")
        request.set_duration_seconds(self._session_period)

        try:
            response_str = self._sts_client.do_action_with_exception(request)
            response = json.loads(response_str.decode('utf-8'))
            session_ak = str(response.get("SessionAccessKey").get("SessionAccessKeyId"))
            session_sk = str(response.get("SessionAccessKey").get("SessionAccessKeySecret"))

            self._session_credential = session_ak, session_sk
        except exceptions.ServerException as srv_ex:
            if srv_ex.error_code == 'InvalidAccessKeyId.NotFound' or srv_ex.error_code == 'SignatureDoesNotMatch':
                raise exceptions.ClientException(error_code.SDK_INVALID_CREDENTIAL,
                                                 error_msg.get_msg('SDK_INVALID_CREDENTIAL'))
            else:
                raise

aliyun-python-sdk-core-v3

The core module of Aliyun Python SDK.

Apache-2.0
Latest version published 3 years ago

Package Health Score

61 / 100
Full package analysis

Similar packages