QUOTA_EXCEEDED is not mapped to TooManyRequestsError, so rate limiting arrives untyped
维护者通常 4 天内回复
还没有人认领这个 Issue。
评估
调研方向
从 response_handler.py 中的三个错误映射和 check_response 开始检查,尤其是第 60 行附近现有的 TooManyRequestsError 映射。复现 issue 中的 FakeResp 用例,然后验证 QUOTA_EXCEEDED 响应会引发 TooManyRequestsError,而不是通用的 OverkizError。实际的速率限制响应与预期的 back-off 路径保持一致的类型,即表示完成。
由索引模型根据 Issue 内容生成。
描述
🐛 The problem
The Overkiz cloud reports its polling quota with errorCode: QUOTA_EXCEEDED, which matches none of the three error maps in response_handler.py, so it falls through to the generic raise at the end of check_response:
pyoverkiz.exceptions.OverkizError: {'errorCode': 'QUOTA_EXCEEDED', 'error': 'Too many requests, try again later'}
TooManyRequestsError is only reachable for a different errorCode (response_handler.py:60):
("AUTHENTICATION_ERROR", "Too many requests", TooManyRequestsError),
So the one exception type that means "you are being rate limited" is never raised for the server's actual rate-limit response.
🔁 Reproduction
import asyncio
from pyoverkiz.response_handler import check_response
from pyoverkiz.exceptions import OverkizError, TooManyRequestsError
class FakeResp:
status = 403
url = "https://example/events/x/fetch"
async def json(self, content_type=None):
return {"errorCode": "QUOTA_EXCEEDED",
"error": "Too many requests, try again later"}
async def main():
try:
await check_response(FakeResp())
except TooManyRequestsError:
print("typed")
except OverkizError as err:
print("untyped:", err)
asyncio.run(main()) # -> untyped: {'errorCode': 'QUOTA_EXCEEDED', ...}
Why none of the maps catch it:
_ERROR_CODE_MESSAGE_MAP(:47) — has noQUOTA_EXCEEDEDentry_MESSAGE_FALLBACK_MAP(:104) — has"Too many executions"and"Too many attempts with an invalid token", but not"Too many requests"_ERROR_CODE_FALLBACK_MAP(:121) — onlyAUTHENTICATION_ERRORandRESOURCE_ACCESS_DENIED
📉 Why it matters
Callers cannot distinguish rate limiting from an unknown server error without string-matching the payload, so any back-off keyed on TooManyRequestsError silently never runs.
Measured on an Atlantic Cozytouch V2 hub (cloud API), eight commands issued in parallel to eight heaters, Home Assistant's overkiz integration:
| observed | |
|---|---|
fetch_events rate during the burst |
1.32 /s (documented limit: 1/s) |
| polling intervals under 1 s | 5, shortest 0.23 s |
QUOTA_EXCEEDED raised |
1 |
| commands that reached the hub | 5 / 8 |
Because the error arrives untyped:
- it surfaces as
Unexpected error fetching device events datawith a full traceback, rather than a handled rate-limit path - the coordinator keeps polling at the interval that hit the limit instead of slowing down
- the failed update marks every entity
unavailable, and Home Assistant then refuses the remaining service calls —Referenced entities ... are missing or not currently available— so three commands were silently dropped - worst state-delivery lag in that run was 28.97 s
✅ Suggested fix
Either map the code directly in _ERROR_CODE_MESSAGE_MAP:
("QUOTA_EXCEEDED", None, TooManyRequestsError),
…or, more robustly, add the message to _MESSAGE_FALLBACK_MAP so it matches whatever errorCode carries it:
("Too many requests", TooManyRequestsError),
The second also covers the existing AUTHENTICATION_ERROR variant, and any future code the cloud attaches to the same message.
🧾 Environment
pyoverkiz2.1.0- Hub: Atlantic Cozytouch V2 (
io://****-****-9776), cloud API — local API not available for this server - Seen on the
events/{listener_id}/fetchendpoint, documented as "1 calls per 1 SECONDS period for this particular operation (polling)"
Happy to open a PR for whichever form you prefer.
- 主要语言
- Python
- 星标
- 58
- 派生
- 35
- 平均合并
- 3 天 15 小时
- 30 天内合并 PR
- 20
环境准备
我们还没有检查这个项目的环境配置文件。先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
iMicknl/python-overkiz-api 的其他 Issue
-
blocked feature
难度 4/5 3-5 天 新手友好度 35/100
iMicknl/python-overkiz-api#1525 · 5 条评论 ·
维护者通常 4 天内回复
查看 iMicknl/python-overkiz-api 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
spec-kitty/spec-kitty#5319 ·
维护者通常 1 天内回复
-
backend::vllm diffusion multimodal
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
openai/openai-agents-python#5229 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复