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:
parent
7383e81609
commit
8d61893c39
79 changed files with 214 additions and 154 deletions
|
@ -8,7 +8,7 @@ import requests
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.const import CONF_NAME
|
||||
from homeassistant.const import CONF_NAME, HTTP_OK
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
|
@ -66,7 +66,7 @@ class SigfoxAPI:
|
|||
"""Check API credentials are valid."""
|
||||
url = urljoin(API_URL, "devicetypes")
|
||||
response = requests.get(url, auth=self._auth, timeout=10)
|
||||
if response.status_code != 200:
|
||||
if response.status_code != HTTP_OK:
|
||||
if response.status_code == 401:
|
||||
_LOGGER.error("Invalid credentials for Sigfox API")
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue