edit-icon download-icon

Quick start

Last Updated: Apr 19, 2018

Procedure

  1. Create AcsClient instance.

    1. client = AcsClient(access_key_id, access_key_secret, mps_region_id);
  2. Create request and set parameters.

    1. request = SubmitJobsRequest.SubmitJobsRequest()
    2. request.set_accept_format('json')
  3. Initiate API request and display returned value.

    1. response_str = client.do_action_with_exception(request)
    2. response = json.loads(response_str)
    3. print 'PipelineName is:', response['PipelineList']['Pipeline'][0]['Name']
    4. print 'PipelineId is:', response['PipelineList']['Pipeline'][0]['Id']

Full code

  1. # -*- coding: utf8 -*-
  2. import json
  3. from aliyunsdkcore.client import AcsClient
  4. from aliyunsdkmts.request.v20140618 import SearchPipelineRequest
  5. access_key_id = 'xxx'
  6. access_key_secret = 'xxx'
  7. mps_region_ids = ['cn-hangzhou', 'cn-beijing', 'cn-shenzhen', 'cn-shanghai',
  8. 'cn-hongkong', 'us-west-1', 'ap-southeast-1',
  9. 'ap-northeast-1', 'eu-central-1', 'ap-south-1']
  10. for mps_region_id in mps_region_ids:
  11. print 'region is:', mps_region_id
  12. # Create AcsClient instance
  13. client = AcsClient(access_key_id, access_key_secret, mps_region_id)
  14. # Create request, and set parameters
  15. request = SearchPipelineRequest.SearchPipelineRequest()
  16. request.set_accept_format('json')
  17. # Initiate API request and diaplay returned value
  18. response_str = client.do_action_with_exception(request)
  19. response = json.loads(response_str)
  20. print 'PipelineName is:', response['PipelineList']['Pipeline'][0]['Name']
  21. print 'PipelineId is:', response['PipelineList']['Pipeline'][0]['Id']
Thank you! We've received your feedback.