From ceef735d2957df8d02f90e197e2a84a91594d1e6 Mon Sep 17 00:00:00 2001 From: RemixDev Date: Sat, 19 Sep 2020 11:46:58 +0200 Subject: [PATCH] Added function to change accept language in deezer api --- deemix/__init__.py | 2 +- deemix/api/deezer.py | 9 ++++++++- setup.py | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/deemix/__init__.py b/deemix/__init__.py index 16de60a..76f7aec 100644 --- a/deemix/__init__.py +++ b/deemix/__init__.py @@ -1,3 +1,3 @@ #!/usr/bin/env python3 -__version__ = "1.3.13" +__version__ = "1.3.14" diff --git a/deemix/api/deezer.py b/deemix/api/deezer.py index 145a18d..95d651a 100755 --- a/deemix/api/deezer.py +++ b/deemix/api/deezer.py @@ -19,7 +19,8 @@ class Deezer: self.api_url = "http://www.deezer.com/ajax/gw-light.php" self.legacy_api_url = "https://api.deezer.com/" self.http_headers = { - "User-Agent": USER_AGENT_HEADER + "User-Agent": USER_AGENT_HEADER, + "Accept-Language": None } self.album_pictures_host = "https://e-cdns-images.dzcdn.net/images/cover/" self.artist_pictures_host = "https://e-cdns-images.dzcdn.net/images/artist/" @@ -42,6 +43,12 @@ class Deezer: self.session.mount('http://', requests.adapters.HTTPAdapter(pool_maxsize=100)) self.session.mount('https://', requests.adapters.HTTPAdapter(pool_maxsize=100)) + def set_accept_language(self, lang): + self.http_headers['Accept-Language'] = lang + + def get_accept_language(self): + return self.http_headers['Accept-Language'] + def get_token(self): token_data = self.gw_api_call('deezer.getUserData') return token_data["results"]["checkForm"] diff --git a/setup.py b/setup.py index 6065784..cef65b8 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ README = (HERE / "README.md").read_text() setup( name="deemix", - version="1.3.13", + version="1.3.14", description="A barebone deezer downloader library", long_description=README, long_description_content_type="text/markdown",