我正在尝试使用kairos API 注册个人资料图片。我有以下 python 代码。
我的python脚本:
#!/usr/bin/python3
import requests
import io
import http.client
import base64
import json
import glob, os
from os.path import basename
dir_path = "/home/Kairos/profiles/msc/"
os.chdir(dir_path)
for file in glob.glob("*.*"):
img_path = file
print(img_path)
files = {'image': (img_path, open(dir_path + img_path, 'rb'), 'image/jpg', {'Expires': '0'})}
headers = {
'app_id': "xxxx",
'app_key': "xxxxxxxxxxxxxxxxxxxxxx",
}
values_enrol = {
'subject_id':'msc',
'gallery_name':'mscGallary'
}
res = requests.post('https://api.kairos.com/enroll', headers=headers, files=files, data=values_enrol)
print(res.content)
但是,我收到一个错误:
"Errors": [
{
"ErrCode": 1002,
"Message": "subject_id one or more required parameters are missing"
},
{
"ErrCode": 1002,
"Message": "gallery_name one or more required parameters are missing"
}
]
}
我在这里做错了什么?请有人帮助我。
提前致谢。