Skip to content

Commit

Permalink
feat: mark Client app_id and app_secret parameters as deprecated (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
browniebroke committed May 20, 2024
1 parent 5844cb1 commit 999ae5f
Showing 1 changed file with 35 additions and 6 deletions.
41 changes: 35 additions & 6 deletions src/deezer/client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import warnings
from typing import Any, ClassVar

import requests
Expand All @@ -25,6 +26,8 @@
User,
)

_UNSET = object()


class Client:
"""
Expand All @@ -34,7 +37,7 @@ class Client:
be passed in to the constructor as kwargs.
>>> import deezer
>>> client = deezer.Client(app_id='foo', app_secret='bar')
>>> client = deezer.Client()
This client provides several methods to retrieve the content most
kinds of Deezer objects, based on their json structure.
Expand All @@ -45,10 +48,17 @@ class Client:
>>> import deezer
>>> client = deezer.Client(headers={'Accept-Language': 'fr'})
:param app_id: application ID.
:param app_secret: application secret.
:param access_token: user access token.
:param headers: a dictionary of headers to be used.
.. deprecated:: 6.2.0
The following parameters will be removed in the next major version:
* **app_id**
* **app_secret**
They were never actively used by the package.
"""

objects_types: ClassVar[dict[str, type[Resource] | None]] = {
Expand All @@ -69,10 +79,29 @@ class Client:
base_url = "https://api.deezer.com"

def __init__(
self, app_id=None, app_secret=None, access_token=None, headers=None, **kwargs
self,
app_id=_UNSET,
app_secret=_UNSET,
access_token=None,
headers=None,
**kwargs,
):
self.app_id = app_id
self.app_secret = app_secret
if app_id is not _UNSET:
warnings.warn(
"The 'app_id' parameter is not actually used and is deprecated. "
"It will be removed in the next major release.",
DeprecationWarning,
stacklevel=2,
)
self.app_id = app_id
if app_secret is not _UNSET:
warnings.warn(
"The 'app_secret' parameter is not actually used and is deprecated. "
"It will be removed in the next major release.",
DeprecationWarning,
stacklevel=2,
)
self.app_secret = app_secret
self.access_token = access_token
self.session = requests.Session()

Expand Down

0 comments on commit 999ae5f

Please sign in to comment.