mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 17:27:10 +00:00
Fix yr HTTP error handling (#36889)
This commit is contained in:
parent
ec440dface
commit
2883aacfa3
@ -21,7 +21,7 @@ from homeassistant.const import (
|
||||
DEVICE_CLASS_HUMIDITY,
|
||||
DEVICE_CLASS_PRESSURE,
|
||||
DEVICE_CLASS_TEMPERATURE,
|
||||
HTTP_OK,
|
||||
HTTP_BAD_REQUEST,
|
||||
PRESSURE_HPA,
|
||||
SPEED_METERS_PER_SECOND,
|
||||
TEMP_CELSIUS,
|
||||
@ -187,7 +187,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 != HTTP_OK:
|
||||
if resp.status >= HTTP_BAD_REQUEST:
|
||||
try_again(f"{resp.url} returned {resp.status}")
|
||||
return
|
||||
text = await resp.text()
|
||||
|
Loading…
x
Reference in New Issue
Block a user