Skip to content

Raise an error when the API does not register a click - #1589

Merged
frenck merged 1 commit into
mainfrom
frenck/station-click-ok
Oct 2, 2026
Merged

frenck merged 1 commit into
mainfrom
frenck/station-click-ok

Conversation

@frenck

@frenck frenck commented Oct 2, 2026

Copy link
Copy Markdown
Owner

Breaking change

None. A click the API does not register now raises a RadioBrowserError with the reason, instead of a generic "unexpected response" error.

Proposed change

Found while comparing with other Radio Browser clients: radiobrowser4j checks the ok field of the click response, not just the HTTP status (source).

station_click() read url straight from the response. A response with "ok": false and no URL ended up as a KeyError, reported as an unexpected response, and the message from the API explaining why was lost. It now checks ok like vote() does (#1584), accepting both the boolean and the string form the documentation shows, and raises a RadioBrowserError with the API's message when the click was not registered.

Type of change

  • Dependency or tooling upgrade
  • Bugfix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Deprecation (replaces or removes a feature, with a migration path)
  • Breaking change (a fix or feature that changes existing behavior)
  • Code quality, refactor, or test-only change
  • Documentation only

Additional information

  • This PR fixes or closes issue: fixes # None
  • This PR is related to: Vote for a station #1584
  • Link to a separate documentation pull request: None

Checklist

  • I fully understand the code in this pull request and can explain every line, including any AI-assisted changes.
  • The change is covered by tests, and poetry run pytest passes locally. A pull request cannot be merged unless CI is green.
  • poetry run prek run --all-files passes (lint, format, and type checks).
  • No commented-out or dead code is left in the pull request.

Check the ok field of the click response, like vote() does, and raise a
RadioBrowserError with the message from the API.
@frenck frenck added the bugfix Inconsistencies or issues which will cause a problem for users or implementers. label Oct 2, 2026
@frenck
frenck merged commit 32aa1a1 into main Oct 2, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Inconsistencies or issues which will cause a problem for users or implementers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant