[microsoft_face] Small error fixes (#5577)

* [microsoft_face] Small error fixes

* add array to exclusion
This commit is contained in:
Pascal Vizeli 2017-01-26 23:18:15 +01:00 committed by GitHub
parent eadf67bd9a
commit 636e7aa31e
3 changed files with 6 additions and 4 deletions

View File

@ -160,8 +160,10 @@ class MicrosoftFaceIdentifyEntity(ImageProcessingFaceIdentifyEntity):
face_data = yield from self._api.call_api(
'post', 'detect', image, binary=True)
face_ids = [data['faceId'] for data in face_data]
if face_data is None or len(face_data) < 1:
return
face_ids = [data['faceId'] for data in face_data]
detect = yield from self._api.call_api(
'post', 'identify',
{'faceIds': face_ids, 'personGroupId': self._face_group})

View File

@ -367,7 +367,7 @@ class MicrosoftFace(object):
answer = yield from response.json()
_LOGGER.debug("Read from microsoft face api: %s", answer)
if response.status == 200:
if response.status == 200 or response.status == 202:
return answer
_LOGGER.warning("Error %d microsoft face api %s",

View File

@ -154,7 +154,7 @@ microsoft_face:
description: Train a person group.
fields:
name:
group:
description: Name of the group
example: 'family'
@ -186,7 +186,7 @@ microsoft_face:
description: Add a new picture to a person.
fields:
name:
person:
description: Name of the person
example: 'Hans'