simple-justwatch-python-api 1.1.0__tar.gz → 1.2.0__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.
- {simple_justwatch_python_api-1.1.0 → simple_justwatch_python_api-1.2.0}/PKG-INFO +1 -1
- {simple_justwatch_python_api-1.1.0 → simple_justwatch_python_api-1.2.0}/pyproject.toml +1 -1
- {simple_justwatch_python_api-1.1.0 → simple_justwatch_python_api-1.2.0}/src/simplejustwatchapi/exceptions.py +11 -0
- {simple_justwatch_python_api-1.1.0 → simple_justwatch_python_api-1.2.0}/src/simplejustwatchapi/justwatch.py +4 -2
- {simple_justwatch_python_api-1.1.0 → simple_justwatch_python_api-1.2.0}/LICENSE +0 -0
- {simple_justwatch_python_api-1.1.0 → simple_justwatch_python_api-1.2.0}/README.md +0 -0
- {simple_justwatch_python_api-1.1.0 → simple_justwatch_python_api-1.2.0}/src/simplejustwatchapi/__init__.py +0 -0
- {simple_justwatch_python_api-1.1.0 → simple_justwatch_python_api-1.2.0}/src/simplejustwatchapi/graphql.py +0 -0
- {simple_justwatch_python_api-1.1.0 → simple_justwatch_python_api-1.2.0}/src/simplejustwatchapi/query.py +0 -0
- {simple_justwatch_python_api-1.1.0 → simple_justwatch_python_api-1.2.0}/src/simplejustwatchapi/tuples.py +0 -0
|
@@ -3,7 +3,7 @@ name = "simple-justwatch-python-api"
|
|
|
3
3
|
authors = [
|
|
4
4
|
{ name = "Electronic Mango", email = "78230210+Electronic-Mango@users.noreply.github.com" },
|
|
5
5
|
]
|
|
6
|
-
version = "1.
|
|
6
|
+
version = "1.2.0"
|
|
7
7
|
description = "A simple JustWatch Python API"
|
|
8
8
|
readme = "README.md"
|
|
9
9
|
license = "MIT"
|
|
@@ -40,4 +40,15 @@ class JustWatchHttpError(JustWatchError):
|
|
|
40
40
|
|
|
41
41
|
This is a general exception for any HTTP-related errors, such as non-`2xx` status
|
|
42
42
|
codes, network errors, timeouts, etc.
|
|
43
|
+
|
|
44
|
+
Attributes:
|
|
45
|
+
msg (str): Error message describing the HTTP error.
|
|
46
|
+
response (str | None): Optional text of the HTTP response, if available.
|
|
47
|
+
Usucally contains JSON with error responses from the API.
|
|
48
|
+
|
|
43
49
|
"""
|
|
50
|
+
|
|
51
|
+
def __init__(self, msg: str, response: str | None = None) -> None:
|
|
52
|
+
"""Init JustWatchHttpError with error message and optional response text."""
|
|
53
|
+
super().__init__(msg)
|
|
54
|
+
self.response = response
|
|
@@ -47,7 +47,7 @@ Each function can raise two exceptions:
|
|
|
47
47
|
country code. |
|
|
48
48
|
"""
|
|
49
49
|
|
|
50
|
-
from httpx import HTTPError, post
|
|
50
|
+
from httpx import HTTPError, HTTPStatusError, post
|
|
51
51
|
|
|
52
52
|
from simplejustwatchapi.exceptions import JustWatchHttpError
|
|
53
53
|
from simplejustwatchapi.query import (
|
|
@@ -538,6 +538,8 @@ def _post_to_jw_graphql_api(request_json: dict) -> dict:
|
|
|
538
538
|
try:
|
|
539
539
|
response = post(_GRAPHQL_API_URL, json=request_json)
|
|
540
540
|
response.raise_for_status()
|
|
541
|
+
return response.json()
|
|
542
|
+
except HTTPStatusError as e:
|
|
543
|
+
raise JustWatchHttpError(str(e), e.response.text) from e
|
|
541
544
|
except HTTPError as e:
|
|
542
545
|
raise JustWatchHttpError(str(e)) from e
|
|
543
|
-
return response.json()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|