Added function to change accept language in deezer api
This commit is contained in:
parent
5fa251ae3a
commit
ceef735d29
|
@ -1,3 +1,3 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
__version__ = "1.3.13"
|
__version__ = "1.3.14"
|
||||||
|
|
|
@ -19,7 +19,8 @@ class Deezer:
|
||||||
self.api_url = "http://www.deezer.com/ajax/gw-light.php"
|
self.api_url = "http://www.deezer.com/ajax/gw-light.php"
|
||||||
self.legacy_api_url = "https://api.deezer.com/"
|
self.legacy_api_url = "https://api.deezer.com/"
|
||||||
self.http_headers = {
|
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.album_pictures_host = "https://e-cdns-images.dzcdn.net/images/cover/"
|
||||||
self.artist_pictures_host = "https://e-cdns-images.dzcdn.net/images/artist/"
|
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('http://', requests.adapters.HTTPAdapter(pool_maxsize=100))
|
||||||
self.session.mount('https://', 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):
|
def get_token(self):
|
||||||
token_data = self.gw_api_call('deezer.getUserData')
|
token_data = self.gw_api_call('deezer.getUserData')
|
||||||
return token_data["results"]["checkForm"]
|
return token_data["results"]["checkForm"]
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -7,7 +7,7 @@ README = (HERE / "README.md").read_text()
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="deemix",
|
name="deemix",
|
||||||
version="1.3.13",
|
version="1.3.14",
|
||||||
description="A barebone deezer downloader library",
|
description="A barebone deezer downloader library",
|
||||||
long_description=README,
|
long_description=README,
|
||||||
long_description_content_type="text/markdown",
|
long_description_content_type="text/markdown",
|
||||||
|
|
Loading…
Reference in New Issue