Added function to change accept language in deezer api

This commit is contained in:
RemixDev 2020-09-19 11:46:58 +02:00
parent 5fa251ae3a
commit ceef735d29
3 changed files with 10 additions and 3 deletions

View File

@ -1,3 +1,3 @@
#!/usr/bin/env python3
__version__ = "1.3.13"
__version__ = "1.3.14"

View File

@ -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"]

View File

@ -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",