全部产品
云市场
云游戏

Python SDK

更新时间:2020-07-15 10:16:34

Python SDK简介

获取SDK

pip install aliyun-python-sdk-core # 安装阿里云 SDK 核心库
pip install aliyun-python-sdk-address-purification # 安装地址标准化SDK

使用示例

# -*- coding: utf8 -*- import json
from aliyunsdkcore.client import AcsClient
from aliyunsdkcore.acs_exception.exceptions import ClientException
from aliyunsdkcore.acs_exception.exceptions import ServerException
from aliyunsdkaddress_purification.request.v20191118 import ClassifyPOIRequest
# Initialize AcsClient instance
client = AcsClient(
  "<your-access-id-key>",
  "<your-access-id-secret>",
  "cn-hangzhou"
);
# Initialize a request and set parameters
request = ClassifyPOIRequest.ClassifyPOIRequest()
request.set_ServiceCode("addrp");
request.set_AppKey("xxxxxx");
request.set_Text("杭州市文一西路969号");
request.set_DefaultProvince("浙江省");
request.set_DefaultCity("杭州市");
request.set_DefaultDistrict("余杭区");
# Print response
response = client.do_action_with_exception(request)
resp_obj = json.loads(response)
print(resp_obj['Data'])