Check updated_date for list and pick first (#22008)

This commit is contained in:
Gijs Reichert authored and Paulus Schoutsen committed 2019-03-13 13:00:58 -07:00
1 parent 2dcd9d94c8
commit 1ffc0e3c7c
1 file changed
+5 -1
+5 -1
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']