Check updated_date for list and pick first (#22008)

pull/22014/head
Gijs Reichert 2019-03-13 21:00:58 +01:00 committed by Paulus Schoutsen
parent 2dcd9d94c8
commit 1ffc0e3c7c
1 changed files with 5 additions and 1 deletions

View File

@ -134,7 +134,11 @@ class WhoisSensor(Entity):
attrs[ATTR_NAME_SERVERS] = ' '.join(response['nameservers'])
if 'updated_date' in response:
attrs[ATTR_UPDATED] = response['updated_date'].isoformat()
update_date = response['updated_date']
if isinstance(update_date, list):
attrs[ATTR_UPDATED] = update_date[0].isoformat()
else:
attrs[ATTR_UPDATED] = update_date.isoformat()
if 'registrar' in response:
attrs[ATTR_REGISTRAR] = response['registrar']