mirror of
https://github.com/home-assistant/core.git
synced 2025-11-16 14:30:22 +00:00
Use HTTP_OK constant (#33798)
* Use http ok constant * Remove incorrect use * Run isort * Fix pylint by adding missing imports * Fix pylint by fixing one import
This commit is contained in:
@@ -12,6 +12,7 @@ from homeassistant.const import (
|
||||
CONF_BASE,
|
||||
CONF_NAME,
|
||||
CONF_QUOTE,
|
||||
HTTP_OK,
|
||||
)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
@@ -49,7 +50,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
rest = OpenexchangeratesData(_RESOURCE, parameters, quote)
|
||||
response = requests.get(_RESOURCE, params=parameters, timeout=10)
|
||||
|
||||
if response.status_code != 200:
|
||||
if response.status_code != HTTP_OK:
|
||||
_LOGGER.error("Check your OpenExchangeRates API key")
|
||||
return False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user