mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
parent
2c1db10986
commit
27e81fe0ed
@ -59,9 +59,9 @@ class HabiticaDataUpdateCoordinator(DataUpdateCoordinator[HabiticaData]):
|
|||||||
tasks_response.extend(await self.api.tasks.user.get(type="completedTodos"))
|
tasks_response.extend(await self.api.tasks.user.get(type="completedTodos"))
|
||||||
except ClientResponseError as error:
|
except ClientResponseError as error:
|
||||||
if error.status == HTTPStatus.TOO_MANY_REQUESTS:
|
if error.status == HTTPStatus.TOO_MANY_REQUESTS:
|
||||||
_LOGGER.debug("Currently rate limited, skipping update")
|
_LOGGER.debug("Rate limit exceeded, will try again later")
|
||||||
return self.data
|
return self.data
|
||||||
raise UpdateFailed(f"Error communicating with API: {error}") from error
|
raise UpdateFailed(f"Unable to connect to Habitica: {error}") from error
|
||||||
|
|
||||||
return HabiticaData(user=user_response, tasks=tasks_response)
|
return HabiticaData(user=user_response, tasks=tasks_response)
|
||||||
|
|
||||||
|
@ -209,10 +209,10 @@
|
|||||||
"message": "Unable to create new to-do `{name}` for Habitica, please try again"
|
"message": "Unable to create new to-do `{name}` for Habitica, please try again"
|
||||||
},
|
},
|
||||||
"setup_rate_limit_exception": {
|
"setup_rate_limit_exception": {
|
||||||
"message": "Currently rate limited, try again later"
|
"message": "Rate limit exceeded, try again later"
|
||||||
},
|
},
|
||||||
"service_call_unallowed": {
|
"service_call_unallowed": {
|
||||||
"message": "Unable to carry out this action, because the required conditions are not met"
|
"message": "Unable to complete action, the required conditions are not met"
|
||||||
},
|
},
|
||||||
"service_call_exception": {
|
"service_call_exception": {
|
||||||
"message": "Unable to connect to Habitica, try again later"
|
"message": "Unable to connect to Habitica, try again later"
|
||||||
|
@ -207,7 +207,7 @@ async def test_button_press(
|
|||||||
[
|
[
|
||||||
(
|
(
|
||||||
HTTPStatus.TOO_MANY_REQUESTS,
|
HTTPStatus.TOO_MANY_REQUESTS,
|
||||||
"Currently rate limited",
|
"Rate limit exceeded, try again later",
|
||||||
ServiceValidationError,
|
ServiceValidationError,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
@ -217,7 +217,7 @@ async def test_button_press(
|
|||||||
),
|
),
|
||||||
(
|
(
|
||||||
HTTPStatus.UNAUTHORIZED,
|
HTTPStatus.UNAUTHORIZED,
|
||||||
"Unable to carry out this action",
|
"Unable to complete action, the required conditions are not met",
|
||||||
ServiceValidationError,
|
ServiceValidationError,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -165,4 +165,4 @@ async def test_coordinator_rate_limited(
|
|||||||
async_fire_time_changed(hass)
|
async_fire_time_changed(hass)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
assert "Currently rate limited, skipping update" in caplog.text
|
assert "Rate limit exceeded, will try again later" in caplog.text
|
||||||
|
Loading…
x
Reference in New Issue
Block a user