simple-justwatch-python-api 0.14__tar.gz → 0.15__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (15) hide show
  1. {simple-justwatch-python-api-0.14 → simple_justwatch_python_api-0.15}/PKG-INFO +31 -14
  2. {simple-justwatch-python-api-0.14 → simple_justwatch_python_api-0.15}/README.md +30 -13
  3. {simple-justwatch-python-api-0.14 → simple_justwatch_python_api-0.15}/pyproject.toml +1 -1
  4. {simple-justwatch-python-api-0.14 → simple_justwatch_python_api-0.15}/src/simple_justwatch_python_api.egg-info/PKG-INFO +31 -14
  5. simple_justwatch_python_api-0.15/src/simplejustwatchapi/main.py +33 -0
  6. {simple-justwatch-python-api-0.14 → simple_justwatch_python_api-0.15}/src/simplejustwatchapi/query.py +8 -2
  7. simple-justwatch-python-api-0.14/src/simplejustwatchapi/main.py +0 -21
  8. {simple-justwatch-python-api-0.14 → simple_justwatch_python_api-0.15}/LICENSE +0 -0
  9. {simple-justwatch-python-api-0.14 → simple_justwatch_python_api-0.15}/setup.cfg +0 -0
  10. {simple-justwatch-python-api-0.14 → simple_justwatch_python_api-0.15}/src/simple_justwatch_python_api.egg-info/SOURCES.txt +0 -0
  11. {simple-justwatch-python-api-0.14 → simple_justwatch_python_api-0.15}/src/simple_justwatch_python_api.egg-info/dependency_links.txt +0 -0
  12. {simple-justwatch-python-api-0.14 → simple_justwatch_python_api-0.15}/src/simple_justwatch_python_api.egg-info/requires.txt +0 -0
  13. {simple-justwatch-python-api-0.14 → simple_justwatch_python_api-0.15}/src/simple_justwatch_python_api.egg-info/top_level.txt +0 -0
  14. {simple-justwatch-python-api-0.14 → simple_justwatch_python_api-0.15}/src/simplejustwatchapi/__init__.py +0 -0
  15. {simple-justwatch-python-api-0.14 → simple_justwatch_python_api-0.15}/src/simplejustwatchapi/justwatch.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: simple-justwatch-python-api
3
- Version: 0.14
3
+ Version: 0.15
4
4
  Summary: A simple JustWatch Python API
5
5
  Author-email: Electronic Mango <78230210+Electronic-Mango@users.noreply.github.com>
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -715,6 +715,7 @@ A simple unofficial JustWatch Python API which uses [`GraphQL`](https://graphql.
715
715
  * [Details](#details)
716
716
  * [Offers for countries](#offers-for-countries)
717
717
  * [Return data structures](#return-data-structures)
718
+ * [Locale, language, country](#locale-language-country)
718
719
  * [Disclaimer](#disclaimer)
719
720
 
720
721
 
@@ -760,10 +761,10 @@ Only the first argument is required, it specifies a title to search.
760
761
  | 4 | `count` | `int` | NO | `4` | Up to how many entries should be returned |
761
762
  | 5 | `best_only` | `bool` | NO | `True` | Determines whether only best offers should be returned |
762
763
 
763
- `country` must be 2-letter code, e.g. `US`, `GB`, `FR`.
764
+ `country` must be **ISO 3166-1 alpha-2** 2-letter code , e.g. `US`, `GB`, `FR`.
764
765
  It should be uppercase, however lowercase codes are automatically converted to uppercase.
765
766
 
766
- `language` is also 2-letter code, lowercase, e.g. `en`, `fr`.
767
+ `language` is a **ISO 639-1** (usually) 2-letter code, lowercase, e.g. `en`, `fr`.
767
768
 
768
769
  `count` determines **up to** how many entries should be returned.
769
770
  If JustWatch GraphQL API returns fewer entries, then this function will also return fewer values.
@@ -792,11 +793,11 @@ results = details("nodeID", "US", "en", False)
792
793
 
793
794
  Only the first argument is required - the node ID of element to look up details for.
794
795
 
795
- | | Argument | Type | Required | Default value | Description |
796
- |---|-------------|--------|----------|---------------|-------------------------------------------------------|
797
- | 1 | `node_id` | `str` | **YES** | - | Node ID to look up |
798
- | 2 | `country` | `str` | NO | `"US"` | Country to search for offers |
799
- | 3 | `language` | `str` | NO | `"en"` | Language of responses |
796
+ | | Argument | Type | Required | Default value | Description |
797
+ |---|-------------|--------|----------|---------------|--------------------------------------------------------|
798
+ | 1 | `node_id` | `str` | **YES** | - | Node ID to look up |
799
+ | 2 | `country` | `str` | NO | `"US"` | Country to search for offers |
800
+ | 3 | `language` | `str` | NO | `"en"` | Language of responses |
800
801
  | 5 | `best_only` | `bool` | NO | `True` | Determines whether only best offers should be returned |
801
802
 
802
803
  General usage of these arguments matches the [`search`](#search) command.
@@ -821,13 +822,13 @@ results = offers_for_countries("nodeID", {"US", "UK", "CA"}, "en", True)
821
822
  First two arguments are required - node ID, and set of countries.
822
823
 
823
824
  | | Argument | Type | Required | Default value | Description |
824
- |---|-------------|------------|:---------|--------------|--------------------------------------------------------|
825
- | 1 | `node_id` | `str` | **YES** | - | Node ID to look up |
826
- | 2 | `countries` | `set[str]` | **YES** | - | Set of countries to look up offers for |
827
- | 3 | `language` | `str` | NO | `"en"` | Language of responses |
828
- | 5 | `best_only` | `bool` | NO | `True` | Determines whether only best offers should be returned |
825
+ |---|-------------|------------|:---------|---------------|--------------------------------------------------------|
826
+ | 1 | `node_id` | `str` | **YES** | - | Node ID to look up |
827
+ | 2 | `countries` | `set[str]` | **YES** | - | Set of countries to look up offers for |
828
+ | 3 | `language` | `str` | NO | `"en"` | Language of responses |
829
+ | 5 | `best_only` | `bool` | NO | `True` | Determines whether only best offers should be returned |
829
830
 
830
- Usage `language` and `best_only` arguments matches the [`search`](#search) command.
831
+ Usage of `language` and `best_only` arguments matches the [`search`](#search) command.
831
832
 
832
833
  Returned value `dict[str, list[Offer]]`, where key is country given as argument and value is a list of [`Offer`](#return-data-structures) tuples.
833
834
 
@@ -841,6 +842,22 @@ Detailed descriptions of all used data structures are available in the [document
841
842
 
842
843
 
843
844
 
845
+ ## Locale, language, country
846
+
847
+ Languages and countries are configured via ISO standard.
848
+ Countries are following **ISO 3166-1 alpha-2** standard (2-letter codes, uppercase).
849
+ Languages are following **ISO 639-1** standard (usually 2-letter codes, lowercase).
850
+
851
+ Language codes can also be country-specific, e.g. `es-MX` for Mexican Spanish, etc.
852
+ The country part **must** be uppercase.
853
+
854
+ There is a list of supported locales in [JustWatch **REST API** documentation](https://apis.justwatch.com/docs/api/#tips).
855
+ Any combination of those languages and countries should work with this API as well.
856
+
857
+ If you provide unsupported language JustWatch API should default to english.
858
+
859
+
860
+
844
861
  ## Disclaimer
845
862
 
846
863
  This API is in no way affiliated, associated, authorized, endorsed by, or in any way officially connected with JustWatch.
@@ -20,6 +20,7 @@ A simple unofficial JustWatch Python API which uses [`GraphQL`](https://graphql.
20
20
  * [Details](#details)
21
21
  * [Offers for countries](#offers-for-countries)
22
22
  * [Return data structures](#return-data-structures)
23
+ * [Locale, language, country](#locale-language-country)
23
24
  * [Disclaimer](#disclaimer)
24
25
 
25
26
 
@@ -65,10 +66,10 @@ Only the first argument is required, it specifies a title to search.
65
66
  | 4 | `count` | `int` | NO | `4` | Up to how many entries should be returned |
66
67
  | 5 | `best_only` | `bool` | NO | `True` | Determines whether only best offers should be returned |
67
68
 
68
- `country` must be 2-letter code, e.g. `US`, `GB`, `FR`.
69
+ `country` must be **ISO 3166-1 alpha-2** 2-letter code , e.g. `US`, `GB`, `FR`.
69
70
  It should be uppercase, however lowercase codes are automatically converted to uppercase.
70
71
 
71
- `language` is also 2-letter code, lowercase, e.g. `en`, `fr`.
72
+ `language` is a **ISO 639-1** (usually) 2-letter code, lowercase, e.g. `en`, `fr`.
72
73
 
73
74
  `count` determines **up to** how many entries should be returned.
74
75
  If JustWatch GraphQL API returns fewer entries, then this function will also return fewer values.
@@ -97,11 +98,11 @@ results = details("nodeID", "US", "en", False)
97
98
 
98
99
  Only the first argument is required - the node ID of element to look up details for.
99
100
 
100
- | | Argument | Type | Required | Default value | Description |
101
- |---|-------------|--------|----------|---------------|-------------------------------------------------------|
102
- | 1 | `node_id` | `str` | **YES** | - | Node ID to look up |
103
- | 2 | `country` | `str` | NO | `"US"` | Country to search for offers |
104
- | 3 | `language` | `str` | NO | `"en"` | Language of responses |
101
+ | | Argument | Type | Required | Default value | Description |
102
+ |---|-------------|--------|----------|---------------|--------------------------------------------------------|
103
+ | 1 | `node_id` | `str` | **YES** | - | Node ID to look up |
104
+ | 2 | `country` | `str` | NO | `"US"` | Country to search for offers |
105
+ | 3 | `language` | `str` | NO | `"en"` | Language of responses |
105
106
  | 5 | `best_only` | `bool` | NO | `True` | Determines whether only best offers should be returned |
106
107
 
107
108
  General usage of these arguments matches the [`search`](#search) command.
@@ -126,13 +127,13 @@ results = offers_for_countries("nodeID", {"US", "UK", "CA"}, "en", True)
126
127
  First two arguments are required - node ID, and set of countries.
127
128
 
128
129
  | | Argument | Type | Required | Default value | Description |
129
- |---|-------------|------------|:---------|--------------|--------------------------------------------------------|
130
- | 1 | `node_id` | `str` | **YES** | - | Node ID to look up |
131
- | 2 | `countries` | `set[str]` | **YES** | - | Set of countries to look up offers for |
132
- | 3 | `language` | `str` | NO | `"en"` | Language of responses |
133
- | 5 | `best_only` | `bool` | NO | `True` | Determines whether only best offers should be returned |
130
+ |---|-------------|------------|:---------|---------------|--------------------------------------------------------|
131
+ | 1 | `node_id` | `str` | **YES** | - | Node ID to look up |
132
+ | 2 | `countries` | `set[str]` | **YES** | - | Set of countries to look up offers for |
133
+ | 3 | `language` | `str` | NO | `"en"` | Language of responses |
134
+ | 5 | `best_only` | `bool` | NO | `True` | Determines whether only best offers should be returned |
134
135
 
135
- Usage `language` and `best_only` arguments matches the [`search`](#search) command.
136
+ Usage of `language` and `best_only` arguments matches the [`search`](#search) command.
136
137
 
137
138
  Returned value `dict[str, list[Offer]]`, where key is country given as argument and value is a list of [`Offer`](#return-data-structures) tuples.
138
139
 
@@ -146,6 +147,22 @@ Detailed descriptions of all used data structures are available in the [document
146
147
 
147
148
 
148
149
 
150
+ ## Locale, language, country
151
+
152
+ Languages and countries are configured via ISO standard.
153
+ Countries are following **ISO 3166-1 alpha-2** standard (2-letter codes, uppercase).
154
+ Languages are following **ISO 639-1** standard (usually 2-letter codes, lowercase).
155
+
156
+ Language codes can also be country-specific, e.g. `es-MX` for Mexican Spanish, etc.
157
+ The country part **must** be uppercase.
158
+
159
+ There is a list of supported locales in [JustWatch **REST API** documentation](https://apis.justwatch.com/docs/api/#tips).
160
+ Any combination of those languages and countries should work with this API as well.
161
+
162
+ If you provide unsupported language JustWatch API should default to english.
163
+
164
+
165
+
149
166
  ## Disclaimer
150
167
 
151
168
  This API is in no way affiliated, associated, authorized, endorsed by, or in any way officially connected with JustWatch.
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
5
5
  [project]
6
6
  name = "simple-justwatch-python-api"
7
7
  authors = [{name = "Electronic Mango", email = "78230210+Electronic-Mango@users.noreply.github.com"}]
8
- version = "0.14"
8
+ version = "0.15"
9
9
  description="A simple JustWatch Python API"
10
10
  readme = "README.md"
11
11
  license = {file = "LICENSE"}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: simple-justwatch-python-api
3
- Version: 0.14
3
+ Version: 0.15
4
4
  Summary: A simple JustWatch Python API
5
5
  Author-email: Electronic Mango <78230210+Electronic-Mango@users.noreply.github.com>
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -715,6 +715,7 @@ A simple unofficial JustWatch Python API which uses [`GraphQL`](https://graphql.
715
715
  * [Details](#details)
716
716
  * [Offers for countries](#offers-for-countries)
717
717
  * [Return data structures](#return-data-structures)
718
+ * [Locale, language, country](#locale-language-country)
718
719
  * [Disclaimer](#disclaimer)
719
720
 
720
721
 
@@ -760,10 +761,10 @@ Only the first argument is required, it specifies a title to search.
760
761
  | 4 | `count` | `int` | NO | `4` | Up to how many entries should be returned |
761
762
  | 5 | `best_only` | `bool` | NO | `True` | Determines whether only best offers should be returned |
762
763
 
763
- `country` must be 2-letter code, e.g. `US`, `GB`, `FR`.
764
+ `country` must be **ISO 3166-1 alpha-2** 2-letter code , e.g. `US`, `GB`, `FR`.
764
765
  It should be uppercase, however lowercase codes are automatically converted to uppercase.
765
766
 
766
- `language` is also 2-letter code, lowercase, e.g. `en`, `fr`.
767
+ `language` is a **ISO 639-1** (usually) 2-letter code, lowercase, e.g. `en`, `fr`.
767
768
 
768
769
  `count` determines **up to** how many entries should be returned.
769
770
  If JustWatch GraphQL API returns fewer entries, then this function will also return fewer values.
@@ -792,11 +793,11 @@ results = details("nodeID", "US", "en", False)
792
793
 
793
794
  Only the first argument is required - the node ID of element to look up details for.
794
795
 
795
- | | Argument | Type | Required | Default value | Description |
796
- |---|-------------|--------|----------|---------------|-------------------------------------------------------|
797
- | 1 | `node_id` | `str` | **YES** | - | Node ID to look up |
798
- | 2 | `country` | `str` | NO | `"US"` | Country to search for offers |
799
- | 3 | `language` | `str` | NO | `"en"` | Language of responses |
796
+ | | Argument | Type | Required | Default value | Description |
797
+ |---|-------------|--------|----------|---------------|--------------------------------------------------------|
798
+ | 1 | `node_id` | `str` | **YES** | - | Node ID to look up |
799
+ | 2 | `country` | `str` | NO | `"US"` | Country to search for offers |
800
+ | 3 | `language` | `str` | NO | `"en"` | Language of responses |
800
801
  | 5 | `best_only` | `bool` | NO | `True` | Determines whether only best offers should be returned |
801
802
 
802
803
  General usage of these arguments matches the [`search`](#search) command.
@@ -821,13 +822,13 @@ results = offers_for_countries("nodeID", {"US", "UK", "CA"}, "en", True)
821
822
  First two arguments are required - node ID, and set of countries.
822
823
 
823
824
  | | Argument | Type | Required | Default value | Description |
824
- |---|-------------|------------|:---------|--------------|--------------------------------------------------------|
825
- | 1 | `node_id` | `str` | **YES** | - | Node ID to look up |
826
- | 2 | `countries` | `set[str]` | **YES** | - | Set of countries to look up offers for |
827
- | 3 | `language` | `str` | NO | `"en"` | Language of responses |
828
- | 5 | `best_only` | `bool` | NO | `True` | Determines whether only best offers should be returned |
825
+ |---|-------------|------------|:---------|---------------|--------------------------------------------------------|
826
+ | 1 | `node_id` | `str` | **YES** | - | Node ID to look up |
827
+ | 2 | `countries` | `set[str]` | **YES** | - | Set of countries to look up offers for |
828
+ | 3 | `language` | `str` | NO | `"en"` | Language of responses |
829
+ | 5 | `best_only` | `bool` | NO | `True` | Determines whether only best offers should be returned |
829
830
 
830
- Usage `language` and `best_only` arguments matches the [`search`](#search) command.
831
+ Usage of `language` and `best_only` arguments matches the [`search`](#search) command.
831
832
 
832
833
  Returned value `dict[str, list[Offer]]`, where key is country given as argument and value is a list of [`Offer`](#return-data-structures) tuples.
833
834
 
@@ -841,6 +842,22 @@ Detailed descriptions of all used data structures are available in the [document
841
842
 
842
843
 
843
844
 
845
+ ## Locale, language, country
846
+
847
+ Languages and countries are configured via ISO standard.
848
+ Countries are following **ISO 3166-1 alpha-2** standard (2-letter codes, uppercase).
849
+ Languages are following **ISO 639-1** standard (usually 2-letter codes, lowercase).
850
+
851
+ Language codes can also be country-specific, e.g. `es-MX` for Mexican Spanish, etc.
852
+ The country part **must** be uppercase.
853
+
854
+ There is a list of supported locales in [JustWatch **REST API** documentation](https://apis.justwatch.com/docs/api/#tips).
855
+ Any combination of those languages and countries should work with this API as well.
856
+
857
+ If you provide unsupported language JustWatch API should default to english.
858
+
859
+
860
+
844
861
  ## Disclaimer
845
862
 
846
863
  This API is in no way affiliated, associated, authorized, endorsed by, or in any way officially connected with JustWatch.
@@ -0,0 +1,33 @@
1
+ from itertools import product
2
+
3
+ from justwatch import details, offers_for_countries, search
4
+
5
+
6
+ from dataclasses import dataclass
7
+
8
+
9
+ @dataclass
10
+ class Base:
11
+ base_field_1: int
12
+ base_field_2: int
13
+
14
+
15
+ @dataclass
16
+ class Child(Base):
17
+ child_field_1: int
18
+
19
+
20
+ def main():
21
+ obj = Child(1, 2, 3)
22
+ # result = details("ts4") # Breaking Bad
23
+ # result = details("tss25") # Breaking Bad S5
24
+ # result = details("tse411") # Breaking Bad S5E1
25
+ # result = details("tm10") # The Matrix
26
+ result = details("ts20711") # The Simpsons
27
+ # result = search("The Simpsons")
28
+ print(result)
29
+ print()
30
+
31
+
32
+ if __name__ == "__main__":
33
+ main()
@@ -92,6 +92,7 @@ fragment TitleDetails on MovieOrShow {
92
92
  }
93
93
  externalIds {
94
94
  imdbId
95
+ tmdbId
95
96
  __typename
96
97
  }
97
98
  posterUrl(profile: $profile, format: $formatPoster)
@@ -201,7 +202,7 @@ class Offer(NamedTuple):
201
202
  url: str
202
203
  """URL to this offer."""
203
204
 
204
- element_count: int
205
+ element_count: int | None
205
206
  """Element count, usually 0."""
206
207
 
207
208
  available_to: str | None
@@ -259,6 +260,9 @@ class MediaEntry(NamedTuple):
259
260
  imdb_id: str | None
260
261
  """ID of this entry in IMDB."""
261
262
 
263
+ tmdb_id: str | None
264
+ """ID of this entry in TMDB."""
265
+
262
266
  poster: str | None
263
267
  """URL to poster for this ID."""
264
268
 
@@ -469,6 +473,7 @@ def _parse_entry(json: any) -> MediaEntry:
469
473
  genres = [node.get("shortName") for node in content.get("genres", []) if node]
470
474
  external_ids = content.get("externalIds")
471
475
  imdb_id = external_ids.get("imdbId") if external_ids else None
476
+ tmdb_id = external_ids.get("tmdbId") if external_ids else None
472
477
  poster_url_field = content.get("posterUrl")
473
478
  poster = _IMAGES_URL + poster_url_field if poster_url_field else None
474
479
  backdrops = [_IMAGES_URL + bd.get("backdropUrl") for bd in content.get("backdrops", []) if bd]
@@ -485,6 +490,7 @@ def _parse_entry(json: any) -> MediaEntry:
485
490
  short_description,
486
491
  genres,
487
492
  imdb_id,
493
+ tmdb_id,
488
494
  poster,
489
495
  backdrops,
490
496
  offers,
@@ -502,7 +508,7 @@ def _parse_offer(json: any) -> Offer:
502
508
  type = json.get("type")
503
509
  package = _parse_package(json["package"])
504
510
  url = json.get("standardWebURL")
505
- element_count = json.get("elementCount", 0)
511
+ element_count = json.get("elementCount")
506
512
  available_to = json.get("availableTo")
507
513
  deeplink_roku = json.get("deeplinkRoku")
508
514
  subtitle_languages = json.get("subtitleLanguages")
@@ -1,21 +0,0 @@
1
- from justwatch import details, offers_for_countries, search
2
- from query import MediaEntry, Offer, OfferPackage
3
-
4
-
5
- def main():
6
- response = search("The Matrix", "US", "en", 3, True)
7
- print(response)
8
- print()
9
-
10
- response = details("tm10", "US", "en", False)
11
- print(response)
12
- print()
13
-
14
- response = offers_for_countries("tm10", {"US", "GB", "FR"}, "en", True)
15
- print(response)
16
- print()
17
-
18
-
19
-
20
- if __name__ == "__main__":
21
- main()