Py之huaweicloud-sdk-python:huaweicloud-sdk-python的简介、安装、使用方法之详细攻略

Py之huaweicloud-sdk-python:huaweicloud-sdk-python的简介、安装、使用方法之详细攻略


huaweicloud-sdk-python的简介

huaweicloud-sdk-python是华为云的API,供广大网友利用华为云的产品进行开发设计。

项目描述:The following services’ SDK are included.

  • IAM
  • IMS
  • VPC
  • ECS
  • EVS
  • AutoScaling
  • Cloud Eye
  • DNS
  • ELB
  • VBS
  • CTS
  • Anti-DDos
  • DMS
  • MRS
  • MAAS
  • RDS
  • NAT
  • DEH
  • KMS
  • BMS
  • SMN
  • RTS

huaweicloud-sdk-python的安装

pip install huaweicloud-sdk-python

huaweicloud-sdk-python的使用方法

1、基础用法

ak = "ak"
sk = "sk"
project_id = "projectId"
end_point = " https://face.cn-north-1.myhuaweicloud.com"
proxy = {"http": "http://127.0.0.1:1234",
"https": "http://127.0.0.1:1234"}

auth_info = AuthInfo(ak=ak, sk=sk, end_point=end_point)
frs_client = FrsClient(auth_info=auth_info, project_id=project_id)
# frs_client = FrsClient(auth_info=auth_info, project_id=project_id, proxies=proxy) # 需要使用代理访问云服务时配置

//人脸对比
image1_path = ""
image2_path = ""
cs = frs_client.get_compare_service()
res = cs.compare_face_by_file(image1_path, image2_path)
print res.get_eval_result()

//活体检测
lds = frs_client.get_live_detect_service()
video_file = "data/video.mp4"
actions = "1"
res = lds.live_detect_by_file(video_file, actions)
print res.get_eval_result()
(0)

相关推荐