标签:setup.py python3 xxxxx pip huawei username git limit rem
华为云 获取 弹性云服务器 信息SDK 下载地址 https://github.com/huaweicloud/huaweicloud-sdk-python
cd
pip install -r requirements.txt
python3.6 setup.py install
from openstack import connection
# create connection
username = "hequan"
password = "hequan"
projectId = "xxxxxxxxxxxxxxxxxxxxxxxxx" # tenant ID
userDomainId = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" # user account ID
auth_url = "https://iam.cn-north-1.myhuaweicloud.com" # endpoint url https://ecs.cn-north-1.myhuaweicloud.com
conn = connection.Connection(auth_url=auth_url,
user_domain_id=userDomainId,
project_id=projectId,
username=username,
password=password)
# get list of server
def list_servers():
servers = conn.compute.servers(limit=1)
for server in servers:
print(server)
if __name__ == "__main__":
list_servers()
标签:setup.py python3 xxxxx pip huawei username git limit rem
原文地址:http://blog.51cto.com/hequan/2349473