Greetings, in my code, I try to list only the parameters I need. In this case, they are face attributes and emotions. I still get a mistake. that string indexes must be integers
error list
return user['faceAttributes']['emotion']
TypeError: string indices must be integers
error list
return user['faceAttributes']['emotion']
TypeError: string indices must be integers
headers = { 'Ocp-Apim-Subscription-Key': 'cccf20b44cb9445a8a4239ce324acfed', 'Content-Type': 'application/octet-stream' } parameters = { 'returnFaceId': 'true', 'returnFaceLandmarks': 'false', 'returnFaceAttributes': 'age,gender,emotion' } def post_image(img_data): response = requests.post(BASE_URL, params=parameters, headers=headers, data=img_data) try: return response.json() except: return None def get_emotions(jsonData): j = json.dumps(jsonData) halo = json.loads(j) for user in halo: return user['faceAttributes']['emotion']