1
mirror of https://github.com/home-assistant/core synced 2024-08-28 03:36:46 +02:00

Fix aiohttp code DeprecationWarnings (#97621)

This commit is contained in:
Marc Mueller 2023-08-02 20:28:18 +02:00 committed by GitHub
parent 02f8000f6c
commit 1a77121c02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 10 additions and 10 deletions

View File

@ -153,7 +153,7 @@ class BondFan(BondEntity, FanEntity):
except ClientResponseError as ex:
raise HomeAssistantError(
"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
async def async_set_speed_belief(self, speed: int) -> None:

View File

@ -138,7 +138,7 @@ class BondBaseLight(BondEntity, LightEntity):
except ClientResponseError as ex:
raise HomeAssistantError(
"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
async def async_set_power_belief(self, power_state: bool) -> None:
@ -150,7 +150,7 @@ class BondBaseLight(BondEntity, LightEntity):
except ClientResponseError as ex:
raise HomeAssistantError(
"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
@ -313,7 +313,7 @@ class BondFireplace(BondEntity, LightEntity):
except ClientResponseError as ex:
raise HomeAssistantError(
"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
async def async_set_power_belief(self, power_state: bool) -> None:
@ -325,5 +325,5 @@ class BondFireplace(BondEntity, LightEntity):
except ClientResponseError as ex:
raise HomeAssistantError(
"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

View File

@ -65,5 +65,5 @@ class BondSwitch(BondEntity, SwitchEntity):
except ClientResponseError as ex:
raise HomeAssistantError(
"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

View File

@ -149,8 +149,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
try:
await session.async_ensure_token_valid()
except aiohttp.ClientResponseError as ex:
_LOGGER.debug("API error: %s (%s)", ex.code, ex.message)
if ex.code in (
_LOGGER.debug("API error: %s (%s)", ex.status, ex.message)
if ex.status in (
HTTPStatus.BAD_REQUEST,
HTTPStatus.UNAUTHORIZED,
HTTPStatus.FORBIDDEN,

View File

@ -220,7 +220,7 @@ def patch_bond_action_returns_clientresponseerror():
return patch(
"homeassistant.components.bond.Bond.action",
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"
),
)

View File

@ -415,7 +415,7 @@ async def test_setup_component_invalid_token(hass: HomeAssistant, config_entry)
headers={},
real_url="http://example.com",
),
code=400,
status=400,
history=(),
)