【Python】阿里雲python sdk快速入門
1 示列程式碼如下
# -*- coding: utf8 -*- from aliyunsdkcore.client import AcsClient from aliyunsdkcore.acs_exception.exceptions import ClientException from aliyunsdkcore.acs_exception.exceptions import ServerException from aliyunsdkecs.request.v20140526 import DescribeInstancesRequest from aliyunsdkecs.request.v20140526 import StopInstanceRequest from aliyunsdkrds.request.v20140815 import DescribeDBInstancesRequest # 建立 AcsClient 例項 client = AcsClient( "XXXXXXXXXX", "XXXXXXXXXXXXX", "XXXXXXXXX" ); # 建立 request,並設定引數 request = DescribeDBInstancesRequest.DescribeDBInstancesRequest() request.set_PageSize(10) # 發起 API 請求並列印返回 response = client.do_action_with_exception(request) print response
返回結果
{ "Items": { "DBInstance": [ { "LockMode": "Unlock", "DBInstanceNetType": "Intranet", "DBInstanceClass": "mysql.n2.medium.1", "ResourceGroupId": "rg-acfnsgk4qv2czbi", "DBInstanceId": "rm-6gjs5qm4oo40cvnij", "VpcCloudInstanceId": "xxxxxx", "ZoneId": "ap-south-1a", "ReadOnlyDBInstanceIds": { "ReadOnlyDBInstanceId": [ ] }, "InstanceNetworkType": "VPC", "DBInstanceDescription": "xxxxxxxxxx", "ConnectionMode": "Standard", "VSwitchId": "xxxxxxxxx", "VpcId": "xxxxxxxx", "Engine": "MySQL", "MutriORsignle": false, "InsId": 1, "ExpireTime": "", "CreateTime": "2018-08-06T15:35Z", "DBInstanceType": "Primary", "RegionId": "ap-south-1", "EngineVersion": "5.7", "LockReason": "", "DBInstanceStatus": "Running", "PayType": "Postpaid" }, { "LockMode": "Unlock", "DBInstanceNetType": "Intranet", "DBInstanceClass": "rds.mysql.s2.large", "ResourceGroupId": "rg-acfnsgk4qv2czbi", "DBInstanceId": "rm-6gjie25ei5u6sd588", "VpcCloudInstanceId": "rm-6gjie25ei5u6sd588", "ZoneId": "ap-south-1a", "ReadOnlyDBInstanceIds": { "ReadOnlyDBInstanceId": [ ] }, "InstanceNetworkType": "VPC", "DBInstanceDescription": "xxxxxxxxx", "ConnectionMode": "Safe", "VSwitchId": "vsw-a2d94448xglixxx85czqq208lne", "VpcId": "vpc-a2dqe44k2xxk0ci69aewq27vx", "Engine": "MySQL", "MutriORsignle": false, "InsId": 1, "ExpireTime": "2018-08-24T16:00:00Z", "CreateTime": "2018-07-24T21:40Z", "DBInstanceType": "Primary", "RegionId": "ap-south-1", "EngineVersion": "5.6", "LockReason": "", "DBInstanceStatus": "Running", "PayType": "Prepaid" } ] }, "TotalRecordCount": 2, "PageNumber": 1, "RequestId": "DF7ECC24-F87E-4834-83A4-885DA62825E1", "PageRecordCount": 2 }
具體怎麼使用參考如下:
(sdk使用)
(rds的api介面)
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29096438/viewspace-2199788/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Python快速入門Python
- 如何快速入門PythonPython
- Python如何高效、快速入門?Python
- Python Requests模組快速入門Python
- phyon快速入門(python簡介)Python
- Python HTTP庫:requests快速入門PythonHTTP
- Python匿名函式快速入門Python函式
- 十分鐘快速入門 PythonPython
- python 語法總結:Python語法快速入門Python
- Python快速入門,附詳細影片教程Python
- Python3 爬蟲快速入門攻略Python爬蟲
- 5-快速入門Python函式使用Python函式
- Python 3 快速入門 3 —— 模組與類Python
- Python科學計算 - Numpy快速入門Python
- Python快速入門之基礎知識(一)Python
- 人生苦短我用Python,本文助你快速入門Python
- 快速入門:十分鐘學會PythonPython
- Python入門Python
- Python網路爬蟲實戰(一)快速入門Python爬蟲
- 新手入門 如何快速找到Python進階路線?Python
- Python入門(案例)Python
- 【python】git入門PythonGit
- Python(1):入門Python
- python 入門教程Python
- 應該怎麼做才能實現Python快速入門?Python
- Python快速程式設計入門課後程式題答案Python程式設計
- Python快速入門第二彈合法的變數名Python變數
- Python 3 快速入門 2 —— 流程控制與函式Python函式
- Python快速入門,看這一篇就夠了!Python
- Python機器學習、深度學習:快速、完全的Numpy入門指南Python機器學習深度學習
- Python入門難嗎?如何順利入門Python學習?Python
- 『python入門:』 python的介紹Python
- Python教程學習入門影片到進階,Python全套影片合集助你快速提升Python
- 2020年Python基礎教程,Python快速入門教程(非常詳細)Python
- Python3網路爬蟲快速入門實戰解析Python爬蟲
- Python 3 快速入門 1 —— 資料型別與變數Python資料型別變數
- python資料視覺化神庫:Matplotlib快速入門Python視覺化
- Python入門必知的知識點!Python基礎入門Python