Основываясь на API проверки, мы можем знать, что грани должны быть в теле части, а не в параметрах
subscription_key = "xxxx"
assert subscription_key
import json
face_api_url = 'https://westus.api.cognitive.microsoft.com/face/v1.0/verify'
headers = {'Ocp-Apim-Subscription-Key': subscription_key,'Content-Type':'application/json'}
faces = {
"faceId1": "xxxxxxxx",
"faceId2": "xxxxxx"
}
body = json.dumps(faces)
import requests
from pprint import pprint
response = requests.post(face_api_url, headers=headers,data=body)
result = response.json()
pprint(result)
Результат теста:
![enter image description here](https://i.stack.imgur.com/bIB2s.png)
Мы также можем легко сделать это с помощью Python SDK
import cognitive_face as CF
KEY = 'xxxxxx' # Replace with a valid subscription key (keeping the quotes in place).
CF.Key.set(KEY)
BASE_URL = 'https://{location}.api.cognitive.microsoft.com/face/v1.0' # Replace with your regional Base URL
CF.BaseUrl.set(BASE_URL)
result = CF.face.verify("faceId1","faceId2")
print(result)