Repository navigation
List codecs and states - #1583
Merged
Merged
Conversation
Add codecs() and states(), with Codec and State models, next to the country, language and tag lists. states() takes the full country name the API stores to only list the states of one country.
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. Two new methods and two new models.
Proposed change
Two more lists the API documents, next to countries, languages and tags:
codecs()lists the codecs stations stream in, with their station count, asCodecobjects.states()lists the states, provinces and regions stations are in, asStateobjects. It takes acountryto only get the states of one country.Both take the same arguments as the other lists, including the
namefilter from #1581, and refuse the orders the API cannot sort them by. Checked against the live API:codecs?order=votesanswers with a server error like the other lists.Two things about
states()that are now in the docstring and the README:countryfilter takes the full name the API stores, like "The Netherlands" or "Germany". It is case sensitive (germanyfinds nothing), and it is not a country code.A country without a name filter needs a trailing slash in the path (
states/The%20Netherlands/), otherwise the API takes the country for a name filter. The tests cover all four combinations, and escaping.Live:
codecs(name="aac")returns AAC, AAC+, and the AAC video combinations;states(country="The Netherlands")returns 154 states.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).