Repository navigation
Vote for a station - #1584
Merged
Merged
Vote for a station#1584
Conversation
Add vote(), which raises a RadioBrowserError with the message from the API when it does not accept the vote.
4 of 11 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Breaking change
None. A new method.
Proposed change
Adds
vote(uuid=...), for the vote endpoint the library did not cover. Votes are what makes a station rank higher; the API counts one vote per station from the same IP address every 10 minutes.The API documents only the successful answer (
{"ok": true, "message": "voted for station successfully"}), and showsokas a boolean in one place and as a string in another. Both count as accepted. Whenokis anything else,vote()raises aRadioBrowserErrorwith the message from the API, so a caller can tell the user.Not tested against the live API on purpose: that would cast a real vote in the public database. The tests cover both forms of an accepted and a refused vote, escaping of the UUID, and a broken response. Documented in the README, next to
station_click().Type of change
Additional information
Checklist
poetry run pytestpasses locally. A pull request cannot be merged unless CI is green.poetry run prek run --all-filespasses (lint, format, and type checks).