How to use the aliyun-python-sdk-core-v3.aliyunsdkcore.auth.signers.access_key_signer.AccessKeySigner 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 / signers / signer_factory.py View on Github external
def get_signer(cred, region_id, do_action_api, debug=False):
        if cred['ak'] is not None and cred['secret'] is not None:
            access_key_credential = credentials.AccessKeyCredential(cred['ak'], cred['secret'])
            return access_key_signer.AccessKeySigner(access_key_credential)
        elif os.environ.get('ALIYUN_ACCESS_KEY_ID') is not None and os.environ.get('ALIYUN_ACCESS_KEY_SECRET') is not None:
            access_key_credential = credentials.AccessKeyCredential(os.environ.get('ALIYUN_ACCESS_KEY_ID'),
                                                                    os.environ.get('ALIYUN_ACCESS_KEY_SECRET'))
            return access_key_signer.AccessKeySigner(access_key_credential)
        elif cred['credential'] is not None:
            credential = cred['credential']
            if isinstance(credential, credentials.AccessKeyCredential):
                return access_key_signer.AccessKeySigner(credential)
            elif isinstance(credential, credentials.StsTokenCredential):
                return sts_token_signer.StsTokenSigner(credential)
            elif isinstance(credential, credentials.RamRoleArnCredential):
                return ram_role_arn_signer.RamRoleArnSigner(credential, do_action_api)
            elif isinstance(credential, credentials.EcsRamRoleCredential):
                return ecs_ram_role_singer.EcsRamRoleSigner(credential)
            elif isinstance(credential, credentials.RsaKeyPairCredential):
                return rsa_key_pair_signer.RsaKeyPairSigner(credential, region_id, debug)
github aliyun / aliyun-openapi-python-sdk / aliyun-python-sdk-core-v3 / aliyunsdkcore / auth / signers / signer_factory.py View on Github external
def get_signer(cred, region_id, do_action_api, debug=False):
        if cred['ak'] is not None and cred['secret'] is not None:
            access_key_credential = credentials.AccessKeyCredential(cred['ak'], cred['secret'])
            return access_key_signer.AccessKeySigner(access_key_credential)
        elif os.environ.get('ALIYUN_ACCESS_KEY_ID') is not None and os.environ.get('ALIYUN_ACCESS_KEY_SECRET') is not None:
            access_key_credential = credentials.AccessKeyCredential(os.environ.get('ALIYUN_ACCESS_KEY_ID'),
                                                                    os.environ.get('ALIYUN_ACCESS_KEY_SECRET'))
            return access_key_signer.AccessKeySigner(access_key_credential)
        elif cred['credential'] is not None:
            credential = cred['credential']
            if isinstance(credential, credentials.AccessKeyCredential):
                return access_key_signer.AccessKeySigner(credential)
            elif isinstance(credential, credentials.StsTokenCredential):
                return sts_token_signer.StsTokenSigner(credential)
            elif isinstance(credential, credentials.RamRoleArnCredential):
                return ram_role_arn_signer.RamRoleArnSigner(credential, do_action_api)
            elif isinstance(credential, credentials.EcsRamRoleCredential):
                return ecs_ram_role_singer.EcsRamRoleSigner(credential)
            elif isinstance(credential, credentials.RsaKeyPairCredential):
                return rsa_key_pair_signer.RsaKeyPairSigner(credential, region_id, debug)
        elif cred['public_key_id'] is not None and cred['private_key'] is not None:
            logging.info("'AcsClient(regionId, pub_key_id, pri_key)' is deprecated")
            rsa_key_pair_credential = credentials.RsaKeyPairCredential(cred['public_key_id'], cred['private_key'],
                                                                       cred['session_period'], region_id, debug)
github aliyun / aliyun-openapi-python-sdk / aliyun-python-sdk-core-v3 / aliyunsdkcore / auth / signers / signer_factory.py View on Github external
def get_signer(cred, region_id, do_action_api, debug=False):
        if cred['ak'] is not None and cred['secret'] is not None:
            access_key_credential = credentials.AccessKeyCredential(cred['ak'], cred['secret'])
            return access_key_signer.AccessKeySigner(access_key_credential)
        elif os.environ.get('ALIYUN_ACCESS_KEY_ID') is not None and os.environ.get('ALIYUN_ACCESS_KEY_SECRET') is not None:
            access_key_credential = credentials.AccessKeyCredential(os.environ.get('ALIYUN_ACCESS_KEY_ID'),
                                                                    os.environ.get('ALIYUN_ACCESS_KEY_SECRET'))
            return access_key_signer.AccessKeySigner(access_key_credential)
        elif cred['credential'] is not None:
            credential = cred['credential']
            if isinstance(credential, credentials.AccessKeyCredential):
                return access_key_signer.AccessKeySigner(credential)
            elif isinstance(credential, credentials.StsTokenCredential):
                return sts_token_signer.StsTokenSigner(credential)
            elif isinstance(credential, credentials.RamRoleArnCredential):
                return ram_role_arn_signer.RamRoleArnSigner(credential, do_action_api)
            elif isinstance(credential, credentials.EcsRamRoleCredential):
                return ecs_ram_role_singer.EcsRamRoleSigner(credential)
            elif isinstance(credential, credentials.RsaKeyPairCredential):
                return rsa_key_pair_signer.RsaKeyPairSigner(credential, region_id, debug)
        elif cred['public_key_id'] is not None and cred['private_key'] is not None:
            logging.info("'AcsClient(regionId, pub_key_id, pri_key)' is deprecated")
            rsa_key_pair_credential = credentials.RsaKeyPairCredential(cred['public_key_id'], cred['private_key'],
                                                                       cred['session_period'], region_id, debug)
            return rsa_key_pair_signer.RsaKeyPairSigner(rsa_key_pair_credential)
        else:
            raise exceptions.ClientException(error_code.SDK_INVALID_CREDENTIAL,
                                             error_msg.get_msg('SDK_INVALID_CREDENTIAL'))

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