QUOTA_EXCEEDED is not mapped to TooManyRequestsError, so rate limiting arrives untyped
メンテナーはふだん 7 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
調査の方向性
response_handler.py の3つのエラーマップと check_response から始め、特に60行目付近にある既存の TooManyRequestsError のマッピングを確認します。Issue にある FakeResp のケースを再現し、QUOTA_EXCEEDED レスポンスで汎用の OverkizError ではなく TooManyRequestsError が発生することを確認します。実際のレート制限レスポンスが、想定されるバックオフパスと一貫した型になることを確認できれば完了です。
索引モデルが 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時間
- マージ済み PR(30日)
- 20
環境構築
このプロジェクトの環境構築ファイルはまだ確認していません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
iMicknl/python-overkiz-api のほかの issue
-
blocked feature
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
iMicknl/python-overkiz-api#1525 · コメント 5 件 ·
メンテナーはふだん 7 日以内に返信
iMicknl/python-overkiz-api の issue をすべて見る
似ている issue
-
docs pydanty:is-working
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
pydantic/pydantic-ai#8863 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
run-llama/llama_index#23278 ·
メンテナーはふだん 2 日以内に返信
-
documentation from-review-extraction github-actions priority: low severity:nit
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
LearningCircuit/local-deep-research#6946 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
oracle/langchain-oracle#323 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
tenstorrent/tt-metal#58057 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信