Skip to content

Correctly raise exceptions for HTTP errors - #15

Open
leccelecce wants to merge 1 commit into
N0ciple:mainfrom
leccelecce:raise-for-errors
Open

Correctly raise exceptions for HTTP errors#15
leccelecce wants to merge 1 commit into
N0ciple:mainfrom
leccelecce:raise-for-errors

Conversation

@leccelecce

Copy link
Copy Markdown

Right now the library just blindly calls the HTTP library, it doesn't do anything with errors at all.

Discovered this because I was wondering why hass-kef-connector doesn't raise any error in the HASS UI or system logs that I can see, even though I'm trying to use old pykefcontrol against latest LSX II LT firmware.

Should be using response.raise_for_status() to detect any non HTTP 2xx/3xx response code and throwing exception which upstream users can deal with.

danielpetrovic added a commit to danielpetrovic/pykefcontrol that referenced this pull request Apr 24, 2026
- Add "LSXII" to _POST_MODELS so fw3.0 setData calls use POST
  instead of GET (which returns 405 on fw3.0). Supersedes PR N0ciple#16.
- Add "LSX2" → "LSXII" to _MODEL_ALIASES so older firmware or
  API responses using the legacy name still resolve correctly
- Add raise_for_status() before every response.json() call so HTTP
  errors surface instead of being silently swallowed, based on
  leccelecce's work in N0ciple#15

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
danielpetrovic added a commit to danielpetrovic/pykefcontrol that referenced this pull request Apr 26, 2026
- Add "LSXII" to _POST_MODELS so fw3.0 setData calls use POST
  instead of GET (which returns 405 on fw3.0). Supersedes PR N0ciple#16.
- Add "LSX2" → "LSXII" to _MODEL_ALIASES so older firmware or
  API responses using the legacy name still resolve correctly
- Add raise_for_status() before every response.json() call so HTTP
  errors surface instead of being silently swallowed, based on
  leccelecce's work in N0ciple#15

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
danielpetrovic added a commit to danielpetrovic/pykefcontrol that referenced this pull request May 4, 2026
- Add "LSXII" to _POST_MODELS so fw3.0 setData calls use POST
  instead of GET (which returns 405 on fw3.0). Supersedes PR N0ciple#16.
- Add "LSX2" → "LSXII" to _MODEL_ALIASES so older firmware or
  API responses using the legacy name still resolve correctly
- Add raise_for_status() before every response.json() call so HTTP
  errors surface instead of being silently swallowed, based on
  leccelecce's work in N0ciple#15

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant