feat: fetch languages.json from the GH repository #36
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.
The WST won't need to deploy the compiler to PyPI every time we want to change the languages.json file. The file will be fetched from GitHub (main branch), from https://raw.githubusercontent.com/thewca/wca-regulations-compiler/main/wrc/data/languages.json.
Considerations:
requests
library (which I have used before) or the built-inurllib.requests
library. I chose the latter because it's built-in and works perfectly fine for what we need.HTTPError
(e.g. 4xx HTTP errors) orURLError
(e.g. on timeout), but not if the fetched JSON cannot be parsed. In that case, the execution will be aborted when trying to parse the contents of the response. I'm doing it like this because getting an invalid JSON from the repo would be a significant issue that should be checked. I can also make it use the fallback in this case if required.Edit: I'll bump the version in a different PR.