使用阿里云Python SDK

本文为您介绍如何安装及调用阿里云Python SDK。

安装阿里云Python SDK

您可以通过下载Python SDK或使用pip命令的方式安装阿里云Python SDK:

pip3 install -i https://pypi.python.org/simple alibabacloud-et-industry-openapi20210105

调用示例

# -*-coding:utf-8-*- 
from alibabacloud_et_industry_openapi20210105.models import OpenApiInvokeRequest
from alibabacloud_et_industry_openapi20210105.client import Client
from alibabacloud_tea_openapi import models as open_api_models
import uuid,JSON

'''云服务器示例'''
# 初始化Config
config = open_api_models.Config(
    access_key_id='your access_key_id',
    access_key_secret='your access_key_secret',
    region_id='cn-hangzhou'
)
client = Client(config)
# 初始化Request
request = OpenApiInvokeRequest(service_id='your serviceId',type='EXPERIMENT')

uid = str(uuid.uuid4())
suid = ''.join(uid.split('-'))

request.job_id = suid
request.params='{"mv1":{"value":"非金属管,型号规格:PPH d40*3.7 PN10  5米/根  指定品牌兴隆,材质:PPH 外径:40,内壁厚度:3.7,材质:PPH"}}'
print(request)
# 调用api
response = client.open_api_invoke(request)
print(response.body)