# encoding:utf-8
import json
import urllib.request
import base64
'''
人脸搜索
'''
with open("E:\Face_piture\\image1.jpg", 'rb') as f:
base64_data = base64.b64encode(f.read())
codee = base64_data.decode()
params_d = dict()
params_d['image'] = str(codee, encoding='utf-8')
params_d['image_type'] = 'BASE64'
params = json.dumps(params_d).encode('utf-8')
request_url = "https://aip.baidubce.com/rest/2.0/face/v3/search"
params = "{\"image\":\"params\",\"image_type\":\"BASE64\",\"group_id_list\":\"gropu001\",\"quality_control\":\"LOW\"}"
access_token = '已填入'
request_url = request_url + "?access_token=" + access_token
request = urllib.request.Request(url=request_url, data=params.encode(encoding='UTF8'))
request.add_header('Content-Type', 'application/json')
response = urllib.request.urlopen(request)
content = response.read()
if content:
print (content)
这是在人脸识别