mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Fix aiohttp code DeprecationWarnings (#97621)
This commit is contained in:
parent
02f8000f6c
commit
1a77121c02
@ -153,7 +153,7 @@ class BondFan(BondEntity, FanEntity):
|
|||||||
except ClientResponseError as ex:
|
except ClientResponseError as ex:
|
||||||
raise HomeAssistantError(
|
raise HomeAssistantError(
|
||||||
"The bond API returned an error calling set_power_state_belief for"
|
"The bond API returned an error calling set_power_state_belief for"
|
||||||
f" {self.entity_id}. Code: {ex.code} Message: {ex.message}"
|
f" {self.entity_id}. Code: {ex.status} Message: {ex.message}"
|
||||||
) from ex
|
) from ex
|
||||||
|
|
||||||
async def async_set_speed_belief(self, speed: int) -> None:
|
async def async_set_speed_belief(self, speed: int) -> None:
|
||||||
|
@ -138,7 +138,7 @@ class BondBaseLight(BondEntity, LightEntity):
|
|||||||
except ClientResponseError as ex:
|
except ClientResponseError as ex:
|
||||||
raise HomeAssistantError(
|
raise HomeAssistantError(
|
||||||
"The bond API returned an error calling set_brightness_belief for"
|
"The bond API returned an error calling set_brightness_belief for"
|
||||||
f" {self.entity_id}. Code: {ex.code} Message: {ex.message}"
|
f" {self.entity_id}. Code: {ex.status} Message: {ex.message}"
|
||||||
) from ex
|
) from ex
|
||||||
|
|
||||||
async def async_set_power_belief(self, power_state: bool) -> None:
|
async def async_set_power_belief(self, power_state: bool) -> None:
|
||||||
@ -150,7 +150,7 @@ class BondBaseLight(BondEntity, LightEntity):
|
|||||||
except ClientResponseError as ex:
|
except ClientResponseError as ex:
|
||||||
raise HomeAssistantError(
|
raise HomeAssistantError(
|
||||||
"The bond API returned an error calling set_light_state_belief for"
|
"The bond API returned an error calling set_light_state_belief for"
|
||||||
f" {self.entity_id}. Code: {ex.code} Message: {ex.message}"
|
f" {self.entity_id}. Code: {ex.status} Message: {ex.message}"
|
||||||
) from ex
|
) from ex
|
||||||
|
|
||||||
|
|
||||||
@ -313,7 +313,7 @@ class BondFireplace(BondEntity, LightEntity):
|
|||||||
except ClientResponseError as ex:
|
except ClientResponseError as ex:
|
||||||
raise HomeAssistantError(
|
raise HomeAssistantError(
|
||||||
"The bond API returned an error calling set_brightness_belief for"
|
"The bond API returned an error calling set_brightness_belief for"
|
||||||
f" {self.entity_id}. Code: {ex.code} Message: {ex.message}"
|
f" {self.entity_id}. Code: {ex.status} Message: {ex.message}"
|
||||||
) from ex
|
) from ex
|
||||||
|
|
||||||
async def async_set_power_belief(self, power_state: bool) -> None:
|
async def async_set_power_belief(self, power_state: bool) -> None:
|
||||||
@ -325,5 +325,5 @@ class BondFireplace(BondEntity, LightEntity):
|
|||||||
except ClientResponseError as ex:
|
except ClientResponseError as ex:
|
||||||
raise HomeAssistantError(
|
raise HomeAssistantError(
|
||||||
"The bond API returned an error calling set_power_state_belief for"
|
"The bond API returned an error calling set_power_state_belief for"
|
||||||
f" {self.entity_id}. Code: {ex.code} Message: {ex.message}"
|
f" {self.entity_id}. Code: {ex.status} Message: {ex.message}"
|
||||||
) from ex
|
) from ex
|
||||||
|
@ -65,5 +65,5 @@ class BondSwitch(BondEntity, SwitchEntity):
|
|||||||
except ClientResponseError as ex:
|
except ClientResponseError as ex:
|
||||||
raise HomeAssistantError(
|
raise HomeAssistantError(
|
||||||
"The bond API returned an error calling set_power_state_belief for"
|
"The bond API returned an error calling set_power_state_belief for"
|
||||||
f" {self.entity_id}. Code: {ex.code} Message: {ex.message}"
|
f" {self.entity_id}. Code: {ex.status} Message: {ex.message}"
|
||||||
) from ex
|
) from ex
|
||||||
|
@ -149,8 +149,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
try:
|
try:
|
||||||
await session.async_ensure_token_valid()
|
await session.async_ensure_token_valid()
|
||||||
except aiohttp.ClientResponseError as ex:
|
except aiohttp.ClientResponseError as ex:
|
||||||
_LOGGER.debug("API error: %s (%s)", ex.code, ex.message)
|
_LOGGER.debug("API error: %s (%s)", ex.status, ex.message)
|
||||||
if ex.code in (
|
if ex.status in (
|
||||||
HTTPStatus.BAD_REQUEST,
|
HTTPStatus.BAD_REQUEST,
|
||||||
HTTPStatus.UNAUTHORIZED,
|
HTTPStatus.UNAUTHORIZED,
|
||||||
HTTPStatus.FORBIDDEN,
|
HTTPStatus.FORBIDDEN,
|
||||||
|
@ -220,7 +220,7 @@ def patch_bond_action_returns_clientresponseerror():
|
|||||||
return patch(
|
return patch(
|
||||||
"homeassistant.components.bond.Bond.action",
|
"homeassistant.components.bond.Bond.action",
|
||||||
side_effect=ClientResponseError(
|
side_effect=ClientResponseError(
|
||||||
request_info=None, history=None, code=405, message="Method Not Allowed"
|
request_info=None, history=None, status=405, message="Method Not Allowed"
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -415,7 +415,7 @@ async def test_setup_component_invalid_token(hass: HomeAssistant, config_entry)
|
|||||||
headers={},
|
headers={},
|
||||||
real_url="http://example.com",
|
real_url="http://example.com",
|
||||||
),
|
),
|
||||||
code=400,
|
status=400,
|
||||||
history=(),
|
history=(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user