File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11"""Main module orchestrating requests to JustWatch GraphQL API.
22Currently supported requests are:
3+
34 - ``search`` - search for entries via title
45 - ``details`` - get details for given node ID
56 - ``offers_for_countries`` - get all offers for entry with given node ID,
67 can look for offers for multiple countries
8+
79"""
810
911from httpx import post
@@ -82,18 +84,20 @@ def offers_for_countries(
8284
8385 Country codes passed as argument are case-insensitive, however keys in returned dict will match
8486 them exactly. E.g. for countries specified as:
87+
8588 .. code-block:: python
8689
8790 {"uK", "Us", "AU", "ca"}
8891
8992 returned dict will have the following structure:
93+
9094 .. code-block:: python
9195
9296 {
93- "uK": [... offers ...],
94- "Us": [... offers ...],
95- "AU": [... offers ...],
96- "ca": [... offers ...],
97+ "uK": [ ... offers ... ],
98+ "Us": [ ... offers ... ],
99+ "AU": [ ... offers ... ],
100+ "ca": [ ... offers ... ],
97101 }
98102
99103 ``best_only`` allows filtering out redundant offers, e.g. when if provide offers service
Original file line number Diff line number Diff line change 11"""Module responsible for creating GraphQL queries and parsing responses from JustWatch GraphQL API.
22Parsed responses are returned as Python NamedTuples for easier access.
3- Currently only responses from "GetSearchTitles" query are supported.
3+ Currently supported queries are:
4+
5+ - ``GetTitleNode``
6+ - ``GetSearchTitles``
7+ - ``GetTitleOffers``
8+
49"""
510
611from typing import NamedTuple
149154
150155
151156class OfferPackage (NamedTuple ):
152- """Parsed single offer package from JustWatch GraphQL API for single entry."""
157+ """Parsed single offer package from JustWatch GraphQL API for single entry.
158+ Contains information about platform on which given offer is available."""
153159
154160 id : str
155161 package_id : int
@@ -159,7 +165,8 @@ class OfferPackage(NamedTuple):
159165
160166
161167class Offer (NamedTuple ):
162- """Parsed single offer from JustWatch GraphQL API for single entry."""
168+ """Parsed single offer from JustWatch GraphQL API for single entry.
169+ One platform can have multiple offers for one entry available, e.g. renting, buying, etc."""
163170
164171 id : str
165172 monetization_type : str
You can’t perform that action at this time.
0 commit comments