#encoding=utf-8 from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkcore.http.http_config import HttpConfig from huaweicloudsdkvpc.v2 import * def list_vpc(client): try: request = ListVpcsRequest(limit=100) response = client.list_vpcs(request) except exceptions.ClientRequestException as e: print(e) if __name__ == "__main__": ak = "xxx" sk = "xxx" endpoint = "xxx" #api的地址 project_id = "xxx" #项目id config = HttpConfig.get_default_config() config.ignore_ssl_verification = True credentails = BasicCredentials(ak,sk,project_id) vpc_client = VpcClient.new_builder() .with_http_config(config) .with_credentials(credentails) .with_endpoint(endpoint) .build() list_vpc(vpc_client) #获取vpc信息,函数都在vpc_client.py中,点击VpcClient就可以跳转到文件
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)