How to use aliyun-python-sdk-core-v3 - 10 common examples

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 / integration / test_ecs.py View on Github external
def test_ecs(self):

        # init client
        client = AcsClient(
            os.environ['ACCESS_KEY_ID'],
            os.environ['ACCESS_KEY_SECRET'],
            "cn-hangzhou"
        )
        mylogger.info("Init client success")

        # get demo instance attributes
        image_id, security_group_id = TestEcsIntegration.get_demo_ecs_attributes(client)

        # create
        instance_id = TestEcsIntegration.create_instance(client, image_id, security_group_id)

        # wait
        TestEcsIntegration.wait_for_instance(client, instance_id, 'Stopped')

        # start
        TestEcsIntegration.start_instance(client, instance_id)

        # wait
        TestEcsIntegration.wait_for_instance(client, instance_id, 'Running')

        # stop
        TestEcsIntegration.stop_instance(client, instance_id)

        # wait
        TestEcsIntegration.wait_for_instance(client, instance_id, 'Stopped')
github aliyun / aliyun-openapi-python-sdk / aliyun-python-sdk-core-v3 / integration / test_ecs.py View on Github external
os.environ['ACCESS_KEY_SECRET'],
            "cn-hangzhou"
        )
        mylogger.info("Init client success")

        # get demo instance attributes
        image_id, security_group_id = TestEcsIntegration.get_demo_ecs_attributes(client)

        # create
        instance_id = TestEcsIntegration.create_instance(client, image_id, security_group_id)

        # wait
        TestEcsIntegration.wait_for_instance(client, instance_id, 'Stopped')

        # start
        TestEcsIntegration.start_instance(client, instance_id)

        # wait
        TestEcsIntegration.wait_for_instance(client, instance_id, 'Running')

        # stop
        TestEcsIntegration.stop_instance(client, instance_id)

        # wait
        TestEcsIntegration.wait_for_instance(client, instance_id, 'Stopped')

        # delete
        TestEcsIntegration.delete_instance(client, instance_id)

        # wait
        TestEcsIntegration.wait_for_instance(client, instance_id, 'Deleted')
github aliyun / aliyun-openapi-python-sdk / aliyun-python-sdk-core-v3 / integration / test_ecs.py View on Github external
image_id, security_group_id = TestEcsIntegration.get_demo_ecs_attributes(client)

        # create
        instance_id = TestEcsIntegration.create_instance(client, image_id, security_group_id)

        # wait
        TestEcsIntegration.wait_for_instance(client, instance_id, 'Stopped')

        # start
        TestEcsIntegration.start_instance(client, instance_id)

        # wait
        TestEcsIntegration.wait_for_instance(client, instance_id, 'Running')

        # stop
        TestEcsIntegration.stop_instance(client, instance_id)

        # wait
        TestEcsIntegration.wait_for_instance(client, instance_id, 'Stopped')

        # delete
        TestEcsIntegration.delete_instance(client, instance_id)

        # wait
        TestEcsIntegration.wait_for_instance(client, instance_id, 'Deleted')
github aliyun / aliyun-openapi-python-sdk / aliyun-python-sdk-core-v3 / integration / test_ecs.py View on Github external
def test_ecs(self):

        # init client
        client = AcsClient(
            os.environ['ACCESS_KEY_ID'],
            os.environ['ACCESS_KEY_SECRET'],
            "cn-hangzhou"
        )
        mylogger.info("Init client success")

        # get demo instance attributes
        image_id, security_group_id = TestEcsIntegration.get_demo_ecs_attributes(client)

        # create
        instance_id = TestEcsIntegration.create_instance(client, image_id, security_group_id)

        # wait
        TestEcsIntegration.wait_for_instance(client, instance_id, 'Stopped')

        # start
        TestEcsIntegration.start_instance(client, instance_id)

        # wait
        TestEcsIntegration.wait_for_instance(client, instance_id, 'Running')

        # stop
        TestEcsIntegration.stop_instance(client, instance_id)
github aliyun / aliyun-openapi-python-sdk / aliyun-python-sdk-core-v3 / integration / test_ecs.py View on Github external
# init client
        client = AcsClient(
            os.environ['ACCESS_KEY_ID'],
            os.environ['ACCESS_KEY_SECRET'],
            "cn-hangzhou"
        )
        mylogger.info("Init client success")

        # get demo instance attributes
        image_id, security_group_id = TestEcsIntegration.get_demo_ecs_attributes(client)

        # create
        instance_id = TestEcsIntegration.create_instance(client, image_id, security_group_id)

        # wait
        TestEcsIntegration.wait_for_instance(client, instance_id, 'Stopped')

        # start
        TestEcsIntegration.start_instance(client, instance_id)

        # wait
        TestEcsIntegration.wait_for_instance(client, instance_id, 'Running')

        # stop
        TestEcsIntegration.stop_instance(client, instance_id)

        # wait
        TestEcsIntegration.wait_for_instance(client, instance_id, 'Stopped')

        # delete
        TestEcsIntegration.delete_instance(client, instance_id)
github aliyun / aliyun-openapi-python-sdk / aliyun-python-sdk-core-v3 / integration / test_ecs.py View on Github external
TestEcsIntegration.wait_for_instance(client, instance_id, 'Stopped')

        # start
        TestEcsIntegration.start_instance(client, instance_id)

        # wait
        TestEcsIntegration.wait_for_instance(client, instance_id, 'Running')

        # stop
        TestEcsIntegration.stop_instance(client, instance_id)

        # wait
        TestEcsIntegration.wait_for_instance(client, instance_id, 'Stopped')

        # delete
        TestEcsIntegration.delete_instance(client, instance_id)

        # wait
        TestEcsIntegration.wait_for_instance(client, instance_id, 'Deleted')
github aliyun / aliyun-openapi-python-sdk / aliyun-python-sdk-core-v3 / aliyunsdkcore / request.py View on Github external
"""
        Generate signed header
        :param region_id: String
        :param ak: String
        :param secret: String
        :return: Dict
        """
        sign_params = self._get_sign_params()
        if self.get_content() is not None:
            md5_str = md5_tool.get_md5_base64_str(self.get_content())
            self.add_header('Content-MD5', md5_str)
        if 'RegionId' not in sign_params.keys():
            sign_params['RegionId'] = region_id
            self.add_header('x-acs-region-id', region_id)

        signed_headers = roa_signer.get_signature_headers(
            sign_params,
            ak,
            secret,
            self.get_accept_format(),
            self.get_headers(),
            self.get_uri_pattern(),
            self.get_path_params(),
            self.get_method())
        return signed_headers
github aliyun / aliyun-openapi-python-sdk / aliyun-python-sdk-core-v3 / aliyunsdkcore / request.py View on Github external
def get_url(self, region_id, ak=None, secret=None):
        """
        Compose request url without domain
        :param region_id: String
        :return: String
        """
        sign_params = self.get_query_params()
        # if region_id not in sign_params.keys():
        #     sign_params['RegionId'] = region_id
        url = roa_signer.get_url(
            self.get_uri_pattern(),
            sign_params,
            self.get_path_params())
        return url
github aliyun / aliyun-openapi-python-sdk / aliyun-python-sdk-core-v3 / aliyunsdkcore / auth / composer / oss_signature_composer.py View on Github external
def __build_query_string(uri, queries):
    sorted_map = sorted(list(queries.items()), key=lambda queries: queries[0])
    if len(sorted_map) > 0:
        uri += "?"
        for (k, v) in sorted_map:
            uri += k
            if v is not None:
                uri += "="
                uri += v
            uri += roa_signature_composer.QUERY_SEPARATOR
    if uri.find(roa_signature_composer.QUERY_SEPARATOR) >= 0:
        uri = uri[0:(len(uri) - 1)]
    return uri
github aliyun / aliyun-openapi-python-sdk / aliyun-python-sdk-core-v3 / aliyunsdkcore / auth / composer / oss_signature_composer.py View on Github external
def __build_query_string(uri, queries):
    sorted_map = sorted(list(queries.items()), key=lambda queries: queries[0])
    if len(sorted_map) > 0:
        uri += "?"
        for (k, v) in sorted_map:
            uri += k
            if v is not None:
                uri += "="
                uri += v
            uri += roa_signature_composer.QUERY_SEPARATOR
    if uri.find(roa_signature_composer.QUERY_SEPARATOR) >= 0:
        uri = uri[0:(len(uri) - 1)]
    return uri

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