Skip to content

Commit

Permalink
Add description of used country and language codes
Browse files Browse the repository at this point in the history
  • Loading branch information
Electronic-Mango committed Apr 18, 2024
1 parent 839c600 commit a59fd65
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ A simple unofficial JustWatch Python API which uses [`GraphQL`](https://graphql.
* [Details](#details)
* [Offers for countries](#offers-for-countries)
* [Return data structures](#return-data-structures)
* [Locale, language, country](#locale-language-country)
* [Disclaimer](#disclaimer)


Expand Down Expand Up @@ -65,10 +66,10 @@ Only the first argument is required, it specifies a title to search.
| 4 | `count` | `int` | NO | `4` | Up to how many entries should be returned |
| 5 | `best_only` | `bool` | NO | `True` | Determines whether only best offers should be returned |

`country` must be 2-letter code, e.g. `US`, `GB`, `FR`.
`country` must be **ISO 3166-1 alpha-2** 2-letter code , e.g. `US`, `GB`, `FR`.
It should be uppercase, however lowercase codes are automatically converted to uppercase.

`language` is also 2-letter code, lowercase, e.g. `en`, `fr`.
`language` is a **ISO 639-1** (usually) 2-letter code, lowercase, e.g. `en`, `fr`.

`count` determines **up to** how many entries should be returned.
If JustWatch GraphQL API returns fewer entries, then this function will also return fewer values.
Expand Down Expand Up @@ -132,7 +133,7 @@ First two arguments are required - node ID, and set of countries.
| 3 | `language` | `str` | NO | `"en"` | Language of responses |
| 5 | `best_only` | `bool` | NO | `True` | Determines whether only best offers should be returned |

Usage `language` and `best_only` arguments matches the [`search`](#search) command.
Usage of `language` and `best_only` arguments matches the [`search`](#search) command.

Returned value `dict[str, list[Offer]]`, where key is country given as argument and value is a list of [`Offer`](#return-data-structures) tuples.

Expand All @@ -146,6 +147,22 @@ Detailed descriptions of all used data structures are available in the [document



## Locale, language, country

Languages and countries are configured via ISO standard.
Countries are following **ISO 3166-1 alpha-2** standard (2-letter codes, uppercase).
Languages are following **ISO 639-1** standard (usually 2-letter codes, lowercase).

Language codes can also be country-specific, e.g. `es-MX` for Mexican Spanish, etc.
The country part **must** be uppercase.

There is a list of supported locales in [JustWatch **REST API** documentation](https://apis.justwatch.com/docs/api/#tips).
Any combination of those languages and countries should work with this API as well.

If you provide unsupported language JustWatch API should default to english.



## Disclaimer

This API is in no way affiliated, associated, authorized, endorsed by, or in any way officially connected with JustWatch.
Expand Down

0 comments on commit a59fd65

Please sign in to comment.