deezer-python 7.3.0__py3-none-any.whl → 8.0.0__py3-none-any.whl
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.
- deezer/__init__.py +1 -1
- deezer/_mixin.py +5 -4
- deezer/asyncio/client.py +4 -4
- deezer/auth.py +6 -6
- deezer/client.py +4 -4
- deezer/exceptions.py +4 -4
- {deezer_python-7.3.0.dist-info → deezer_python-8.0.0.dist-info}/METADATA +6 -6
- {deezer_python-7.3.0.dist-info → deezer_python-8.0.0.dist-info}/RECORD +11 -11
- {deezer_python-7.3.0.dist-info → deezer_python-8.0.0.dist-info}/WHEEL +1 -1
- {deezer_python-7.3.0.dist-info → deezer_python-8.0.0.dist-info}/licenses/LICENSE.txt +0 -0
- {deezer_python-7.3.0.dist-info → deezer_python-8.0.0.dist-info}/top_level.txt +0 -0
deezer/__init__.py
CHANGED
deezer/_mixin.py
CHANGED
|
@@ -22,9 +22,9 @@ from deezer.resources import (
|
|
|
22
22
|
class DeezerMixin:
|
|
23
23
|
"""Mixin providing shared logic for both sync and async Deezer clients."""
|
|
24
24
|
|
|
25
|
-
_resource_base_class: ClassVar[type[
|
|
25
|
+
_resource_base_class: ClassVar[type[Any]] = Resource
|
|
26
26
|
|
|
27
|
-
objects_types: ClassVar[dict[str, type[
|
|
27
|
+
objects_types: ClassVar[dict[str, type[Any] | None]] = {
|
|
28
28
|
"album": Album,
|
|
29
29
|
"artist": Artist,
|
|
30
30
|
"chart": Chart,
|
|
@@ -75,8 +75,9 @@ class DeezerMixin:
|
|
|
75
75
|
if "id" not in result and resource_id is not None:
|
|
76
76
|
result["id"] = resource_id
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
resource_type_name = result.get("type")
|
|
79
|
+
if isinstance(resource_type_name, str) and resource_type_name in self.objects_types:
|
|
80
|
+
object_class = self.objects_types[resource_type_name]
|
|
80
81
|
elif "type" in result or (not resource_type and "id" in result):
|
|
81
82
|
object_class = self._resource_base_class
|
|
82
83
|
elif resource_type:
|
deezer/asyncio/client.py
CHANGED
|
@@ -2,8 +2,8 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
from typing import ClassVar
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
from
|
|
5
|
+
import httpx2
|
|
6
|
+
from httpx2._types import HeaderTypes
|
|
7
7
|
|
|
8
8
|
from deezer._mixin import DeezerMixin
|
|
9
9
|
from deezer.auth import DeezerQueryAuth
|
|
@@ -30,7 +30,7 @@ from .resources import (
|
|
|
30
30
|
)
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
class AsyncClient(DeezerMixin,
|
|
33
|
+
class AsyncClient(DeezerMixin, httpx2.AsyncClient):
|
|
34
34
|
"""
|
|
35
35
|
An async client to retrieve some basic infos about Deezer resources.
|
|
36
36
|
|
|
@@ -111,7 +111,7 @@ class AsyncClient(DeezerMixin, httpx.AsyncClient):
|
|
|
111
111
|
)
|
|
112
112
|
try:
|
|
113
113
|
response.raise_for_status()
|
|
114
|
-
except
|
|
114
|
+
except httpx2.HTTPStatusError as exc:
|
|
115
115
|
raise DeezerHTTPError.from_http_error(exc) from exc
|
|
116
116
|
json_data = response.json()
|
|
117
117
|
if not isinstance(json_data, dict):
|
deezer/auth.py
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import typing
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import httpx2
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
class DeezerQueryAuth(
|
|
6
|
+
class DeezerQueryAuth(httpx2.Auth):
|
|
7
7
|
"""
|
|
8
|
-
Deezer Auth for
|
|
8
|
+
Deezer Auth for httpx2.
|
|
9
9
|
|
|
10
10
|
Attach given access token to the request,
|
|
11
11
|
by passing it as query parameter.
|
|
@@ -16,12 +16,12 @@ class DeezerQueryAuth(httpx.Auth):
|
|
|
16
16
|
def __init__(self, access_token: str):
|
|
17
17
|
self.access_token = access_token
|
|
18
18
|
|
|
19
|
-
def auth_flow(self, request:
|
|
19
|
+
def auth_flow(self, request: httpx2.Request) -> typing.Generator[httpx2.Request, httpx2.Response, None]:
|
|
20
20
|
"""
|
|
21
21
|
Add authentication query parameter to the request.
|
|
22
22
|
|
|
23
|
-
:param request:
|
|
24
|
-
:return:
|
|
23
|
+
:param request: httpx2.Request
|
|
24
|
+
:return: httpx2.Request
|
|
25
25
|
"""
|
|
26
26
|
request.url = request.url.copy_merge_params({"access_token": self.access_token})
|
|
27
27
|
yield request
|
deezer/client.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
from
|
|
3
|
+
import httpx2
|
|
4
|
+
from httpx2._types import HeaderTypes
|
|
5
5
|
|
|
6
6
|
from deezer._mixin import DeezerMixin
|
|
7
7
|
from deezer.auth import DeezerQueryAuth
|
|
@@ -26,7 +26,7 @@ from deezer.resources import (
|
|
|
26
26
|
)
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
class Client(DeezerMixin,
|
|
29
|
+
class Client(DeezerMixin, httpx2.Client):
|
|
30
30
|
"""
|
|
31
31
|
A client to retrieve some basic infos about Deezer resources.
|
|
32
32
|
|
|
@@ -91,7 +91,7 @@ class Client(DeezerMixin, httpx.Client):
|
|
|
91
91
|
)
|
|
92
92
|
try:
|
|
93
93
|
response.raise_for_status()
|
|
94
|
-
except
|
|
94
|
+
except httpx2.HTTPStatusError as exc:
|
|
95
95
|
raise DeezerHTTPError.from_http_error(exc) from exc
|
|
96
96
|
json_data = response.json()
|
|
97
97
|
if not isinstance(json_data, dict):
|
deezer/exceptions.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import httpx2
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
class DeezerAPIException(Exception):
|
|
@@ -12,9 +12,9 @@ class DeezerRetryableException(DeezerAPIException):
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
class DeezerHTTPError(DeezerAPIException):
|
|
15
|
-
"""Specialization wrapping HTTPError from the
|
|
15
|
+
"""Specialization wrapping HTTPError from the httpx2 library."""
|
|
16
16
|
|
|
17
|
-
def __init__(self, http_exception:
|
|
17
|
+
def __init__(self, http_exception: httpx2.HTTPStatusError, *args: object) -> None:
|
|
18
18
|
if http_exception.response is not None and http_exception.response.text:
|
|
19
19
|
url = http_exception.response.request.url
|
|
20
20
|
status_code = http_exception.response.status_code
|
|
@@ -24,7 +24,7 @@ class DeezerHTTPError(DeezerAPIException):
|
|
|
24
24
|
super().__init__(http_exception, *args)
|
|
25
25
|
|
|
26
26
|
@classmethod
|
|
27
|
-
def from_http_error(cls, exc:
|
|
27
|
+
def from_http_error(cls, exc: httpx2.HTTPStatusError) -> DeezerHTTPError:
|
|
28
28
|
"""Initialize the appropriate internal exception from a HTTPError."""
|
|
29
29
|
if exc.response is not None:
|
|
30
30
|
if exc.response.status_code in {502, 503, 504}:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: deezer-python
|
|
3
|
-
Version:
|
|
3
|
+
Version: 8.0.0
|
|
4
4
|
Summary: A friendly wrapper library for the Deezer API
|
|
5
5
|
Author-email: Bruno Alla <alla.brunoo@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -16,16 +16,16 @@ Classifier: Intended Audience :: Developers
|
|
|
16
16
|
Classifier: Natural Language :: English
|
|
17
17
|
Classifier: Operating System :: OS Independent
|
|
18
18
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.11
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.12
|
|
22
21
|
Classifier: Programming Language :: Python :: 3.13
|
|
23
22
|
Classifier: Programming Language :: Python :: 3.14
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
24
24
|
Classifier: Topic :: Software Development :: Libraries
|
|
25
|
-
Requires-Python: >=3.
|
|
25
|
+
Requires-Python: >=3.11
|
|
26
26
|
Description-Content-Type: text/markdown
|
|
27
27
|
License-File: LICENSE.txt
|
|
28
|
-
Requires-Dist:
|
|
28
|
+
Requires-Dist: httpx2>=2
|
|
29
29
|
Dynamic: license-file
|
|
30
30
|
|
|
31
31
|
# Deezer Python Client
|
|
@@ -48,8 +48,8 @@ Dynamic: license-file
|
|
|
48
48
|
<a href="https://github.com/astral-sh/ruff">
|
|
49
49
|
<img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Ruff">
|
|
50
50
|
</a>
|
|
51
|
-
<a href="https://github.com/
|
|
52
|
-
<img src="https://img.shields.io/
|
|
51
|
+
<a href="https://github.com/j178/prek">
|
|
52
|
+
<img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/j178/prek/master/docs/assets/badge-v0.json" alt="prek">
|
|
53
53
|
</a>
|
|
54
54
|
</p>
|
|
55
55
|
<p align="center">
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
deezer/__init__.py,sha256=
|
|
2
|
-
deezer/_mixin.py,sha256=
|
|
3
|
-
deezer/auth.py,sha256=
|
|
4
|
-
deezer/client.py,sha256=
|
|
1
|
+
deezer/__init__.py,sha256=IC0xqebXr2VwXep3kSYoKhE7Klxi-kLDLH2ECXX5idQ,556
|
|
2
|
+
deezer/_mixin.py,sha256=p0fZVHAQ3T0XVXLRHL2UJlKSaHuAHbhOsKlErbtUrgE,2887
|
|
3
|
+
deezer/auth.py,sha256=JYs6UHyYwz8abSrAXhy2cd-Yr4mm6lwrfEabrNzI_C0,709
|
|
4
|
+
deezer/client.py,sha256=CBj6N_hZJUTWON7qUogjNaQ3GOXsphxwO6E7xmXf1fk,22347
|
|
5
5
|
deezer/dates.py,sha256=raTeUAAOkajl0TTzM2cupzieTY0amzTeZCaaT3gp_iU,648
|
|
6
|
-
deezer/exceptions.py,sha256=
|
|
6
|
+
deezer/exceptions.py,sha256=O338mnzyJ9HugoEAmWlU-q0wtCFsSrCzqY4oRhN8aTU,2008
|
|
7
7
|
deezer/pagination.py,sha256=iufsEnRqjXvtwWDLMnhf_Adptw1dvb8pk3dRsjTHnu8,4108
|
|
8
8
|
deezer/utils.py,sha256=uXCAnEZR0ulro9lz3YHlwsMgjC1_6_twqDVzGgCuuhM,610
|
|
9
9
|
deezer/asyncio/__init__.py,sha256=V42lzmLFsk5K3FpRyTFuz2n_BGpentYQ4ve5MojwzdI,634
|
|
10
|
-
deezer/asyncio/client.py,sha256=
|
|
10
|
+
deezer/asyncio/client.py,sha256=gPtI8iOF27qBKs-utURTqSOesuK32Ew345d1xT4qKHE,16303
|
|
11
11
|
deezer/asyncio/pagination.py,sha256=TGKpx9VpRrrnC0ZA62jCZ81H9JZgfAVdqdhrg3AxgcQ,4943
|
|
12
12
|
deezer/asyncio/resources/__init__.py,sha256=46roTlKPH6DpSRYWApuA54XNVMFuHFNgnNEEBHk2-P0,669
|
|
13
13
|
deezer/asyncio/resources/album.py,sha256=0tJWBrk8jYJ3GQUlYvyCRlGx0HlsdmNEEf7jqQqHN_M,1620
|
|
@@ -35,8 +35,8 @@ deezer/resources/radio.py,sha256=moOdlSJABqCcluInvgbHSwIzSIhDvBQaVyDGdgeVr_0,805
|
|
|
35
35
|
deezer/resources/resource.py,sha256=4ma_lH6S0ZljBQ24MNdOxotGJFL3rGThLSnea-RSweg,5259
|
|
36
36
|
deezer/resources/track.py,sha256=e3DPTsYWq5yNCjMRQhGTrFQHfQUe3xn0mEVYbpL3O_0,1546
|
|
37
37
|
deezer/resources/user.py,sha256=kCgMUEbKt1QJzzBEpYxPNM3IbojMlm1fYYTSgqa4Sug,6899
|
|
38
|
-
deezer_python-
|
|
39
|
-
deezer_python-
|
|
40
|
-
deezer_python-
|
|
41
|
-
deezer_python-
|
|
42
|
-
deezer_python-
|
|
38
|
+
deezer_python-8.0.0.dist-info/licenses/LICENSE.txt,sha256=lGqKEubFaPBoiJVRoHOxg1LYlte1e5kLoq6zWUSRQzQ,1054
|
|
39
|
+
deezer_python-8.0.0.dist-info/METADATA,sha256=rlD77VN_Qr04NGummuZh1asVDBnHIZkx0QwKIRyYpt0,14041
|
|
40
|
+
deezer_python-8.0.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
41
|
+
deezer_python-8.0.0.dist-info/top_level.txt,sha256=yEWpBI2w2sX3SpyAi-ZGzg-lpP8apYE6uEgvnnb7S44,7
|
|
42
|
+
deezer_python-8.0.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|