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:
springstan
2020-04-08 18:47:38 +02:00
committed by GitHub
parent 7383e81609
commit 8d61893c39
79 changed files with 214 additions and 154 deletions

View File

@@ -20,6 +20,7 @@ from homeassistant.const import (
DEVICE_CLASS_HUMIDITY,
DEVICE_CLASS_PRESSURE,
DEVICE_CLASS_TEMPERATURE,
HTTP_OK,
PRESSURE_HPA,
SPEED_METERS_PER_SECOND,
TEMP_CELSIUS,
@@ -185,7 +186,7 @@ class YrData:
websession = async_get_clientsession(self.hass)
with async_timeout.timeout(10):
resp = await websession.get(self._url, params=self._urlparams)
if resp.status != 200:
if resp.status != HTTP_OK:
try_again(f"{resp.url} returned {resp.status}")
return
text = await resp.text()