Fix whois error, check expiration_date for list and pick first (#27930)
This commit is contained in:
1 parent
e01562ceea
commit
9571f869d1
1 file changed
+4
-1
@@ -119,7 +119,10 @@ class WhoisSensor(Entity):
|
||||
attrs = {}
|
||||
|
||||
expiration_date = response["expiration_date"]
|
||||
attrs[ATTR_EXPIRES] = expiration_date.isoformat()
|
||||
if isinstance(expiration_date, list):
|
||||
attrs[ATTR_EXPIRES] = expiration_date[0].isoformat()
|
||||
else:
|
||||
attrs[ATTR_EXPIRES] = expiration_date.isoformat()
|
||||
|
||||
if "nameservers" in response:
|
||||
attrs[ATTR_NAME_SERVERS] = " ".join(response["nameservers"])
|
||||
|
||||
Reference in new issue
Block a user