Upgrade python-whois to 0.7.2 (#26788)
This commit is contained in:
parent
8c580209a6
commit
a9ff15077c
3 changed files with 6 additions and 9 deletions
|
@ -3,7 +3,7 @@
|
|||
"name": "Whois",
|
||||
"documentation": "https://www.home-assistant.io/components/whois",
|
||||
"requirements": [
|
||||
"python-whois==0.7.1"
|
||||
"python-whois==0.7.2"
|
||||
],
|
||||
"dependencies": [],
|
||||
"codeowners": []
|
||||
|
|
|
@ -3,6 +3,7 @@ from datetime import timedelta
|
|||
import logging
|
||||
|
||||
import voluptuous as vol
|
||||
import whois
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
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):
|
||||
"""Set up the WHOIS sensor."""
|
||||
import whois
|
||||
|
||||
domain = config.get(CONF_DOMAIN)
|
||||
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):
|
||||
add_entities([WhoisSensor(name, domain)], True)
|
||||
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
|
||||
except whois.BaseException as ex:
|
||||
_LOGGER.error("Exception %s occurred during WHOIS lookup for %s", ex, domain)
|
||||
|
@ -53,8 +54,6 @@ class WhoisSensor(Entity):
|
|||
|
||||
def __init__(self, name, domain):
|
||||
"""Initialize the sensor."""
|
||||
import whois
|
||||
|
||||
self.whois = whois.whois
|
||||
|
||||
self._name = name
|
||||
|
@ -95,8 +94,6 @@ class WhoisSensor(Entity):
|
|||
|
||||
def update(self):
|
||||
"""Get the current WHOIS data for the domain."""
|
||||
import whois
|
||||
|
||||
try:
|
||||
response = self.whois(self._domain)
|
||||
except whois.BaseException as ex:
|
||||
|
|
|
@ -1569,7 +1569,7 @@ python-velbus==2.0.27
|
|||
python-vlc==1.1.2
|
||||
|
||||
# homeassistant.components.whois
|
||||
python-whois==0.7.1
|
||||
python-whois==0.7.2
|
||||
|
||||
# homeassistant.components.wink
|
||||
python-wink==1.10.5
|
||||
|
|
Loading…
Add table
Reference in a new issue