I am getting access denial error while calling face api but I have the active subscription.
Nayeem Ahsan
0
Reputation points
I am getting an access denial error ()401) while calling a face api but I have an active subscription. I am trying to call this api:
endpoint + f'/face/v1.0/persongroups/{person_group_id}'
This the code: create_person_group(FACE_KEY, FACE_ENDPOINT, person_group_id)
calling this method: def create_person_group(subscription_key, endpoint, person_group_id):
person_group_url = endpoint + f'/face/v1.0/persongroups/{person_group_id}'
headers = {
'Ocp-Apim-Subscription-Key': subscription_key,
'Content-Type': 'application/json',
'X-MS-AZSDK-Telemetry': 'sample=create-face-collection'
}
body = {
'name': 'my_person_group',
'userData': 'A group of persons from an image',
'recognitionModel': 'recognition_04'
}
response = requests.put(person_group_url, headers=headers, json=body)
try:
response.raise_for_status()
except requests.exceptions.HTTPError as err:
print(f"Error in create_person_group: {err.response.text}")
raise
Sign in to answer