mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Upgrade python-whois to 0.7.2 (#26788)
This commit is contained in:
parent
8c580209a6
commit
a9ff15077c
@ -3,7 +3,7 @@
|
|||||||
"name": "Whois",
|
"name": "Whois",
|
||||||
"documentation": "https://www.home-assistant.io/components/whois",
|
"documentation": "https://www.home-assistant.io/components/whois",
|
||||||
"requirements": [
|
"requirements": [
|
||||||
"python-whois==0.7.1"
|
"python-whois==0.7.2"
|
||||||
],
|
],
|
||||||
"dependencies": [],
|
"dependencies": [],
|
||||||
"codeowners": []
|
"codeowners": []
|
||||||
|
@ -3,6 +3,7 @@ from datetime import timedelta
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
import whois
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||||
from homeassistant.const import CONF_NAME
|
from homeassistant.const import CONF_NAME
|
||||||
@ -32,8 +33,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
|||||||
|
|
||||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the WHOIS sensor."""
|
"""Set up the WHOIS sensor."""
|
||||||
import whois
|
|
||||||
|
|
||||||
domain = config.get(CONF_DOMAIN)
|
domain = config.get(CONF_DOMAIN)
|
||||||
name = config.get(CONF_NAME)
|
name = config.get(CONF_NAME)
|
||||||
|
|
||||||
@ -41,7 +40,9 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||||||
if "expiration_date" in whois.whois(domain):
|
if "expiration_date" in whois.whois(domain):
|
||||||
add_entities([WhoisSensor(name, domain)], True)
|
add_entities([WhoisSensor(name, domain)], True)
|
||||||
else:
|
else:
|
||||||
_LOGGER.error("WHOIS lookup for %s didn't contain expiration_date", domain)
|
_LOGGER.error(
|
||||||
|
"WHOIS lookup for %s didn't contain an expiration date", domain
|
||||||
|
)
|
||||||
return
|
return
|
||||||
except whois.BaseException as ex:
|
except whois.BaseException as ex:
|
||||||
_LOGGER.error("Exception %s occurred during WHOIS lookup for %s", ex, domain)
|
_LOGGER.error("Exception %s occurred during WHOIS lookup for %s", ex, domain)
|
||||||
@ -53,8 +54,6 @@ class WhoisSensor(Entity):
|
|||||||
|
|
||||||
def __init__(self, name, domain):
|
def __init__(self, name, domain):
|
||||||
"""Initialize the sensor."""
|
"""Initialize the sensor."""
|
||||||
import whois
|
|
||||||
|
|
||||||
self.whois = whois.whois
|
self.whois = whois.whois
|
||||||
|
|
||||||
self._name = name
|
self._name = name
|
||||||
@ -95,8 +94,6 @@ class WhoisSensor(Entity):
|
|||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
"""Get the current WHOIS data for the domain."""
|
"""Get the current WHOIS data for the domain."""
|
||||||
import whois
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
response = self.whois(self._domain)
|
response = self.whois(self._domain)
|
||||||
except whois.BaseException as ex:
|
except whois.BaseException as ex:
|
||||||
|
@ -1569,7 +1569,7 @@ python-velbus==2.0.27
|
|||||||
python-vlc==1.1.2
|
python-vlc==1.1.2
|
||||||
|
|
||||||
# homeassistant.components.whois
|
# homeassistant.components.whois
|
||||||
python-whois==0.7.1
|
python-whois==0.7.2
|
||||||
|
|
||||||
# homeassistant.components.wink
|
# homeassistant.components.wink
|
||||||
python-wink==1.10.5
|
python-wink==1.10.5
|
||||||
|
Loading…
x
Reference in New Issue
Block a user