先上代码
from qcloud_image import Client from qcloud_image import CIUrl, CIFile, CIBuffer, CIUrls, CIFiles, CIBuffers if __name__ == '__main__': appid = '***' secret_id = '****' secret_key = '*****' #以上三条 在腾讯云控制台中申请 bucket = 'BUCKET' #这里默认 不需要动 client = Client(appid, secret_id, secret_key, bucket) client.use_http() client.set_timeout(30) dic=client.idcard_detect(CIFiles(['F:\Cloude_image\id.jpg']), 0) print(dic['result_list'][0]['data']) print('民族:'+dic['result_list'][0]['data']['nation']) print('性别:'+dic['result_list'][0]['data']['sex']) print('地址:'+dic['result_list'][0]['data']['address']) print('姓名:'+dic['result_list'][0]['data']['name']) print('出生日期:'+dic['result_list'][0]['data']['birth']) print('身份证号:'+dic['result_list'][0]['data']['id'])
运行效果