From e5fe2c79f9674c873c0b11d4bd5aab1c939a4001 Mon Sep 17 00:00:00 2001 From: Il`ya Date: Tue, 21 Jan 2020 15:13:44 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE=20=D0=BF=D0=BE=D0=BB=D1=83=D1=87=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BF=D0=BB=D0=B5=D0=B9=D0=BB=D0=B8=D1=81=D1=82?= =?UTF-8?q?=D0=B0=20=D1=81=20=D0=B0=D0=BB=D0=B8=D1=81=D0=BE=D0=B9=20#185?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yandex_music/utils/request.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/yandex_music/utils/request.py b/yandex_music/utils/request.py index 5df4471..2934db7 100644 --- a/yandex_music/utils/request.py +++ b/yandex_music/utils/request.py @@ -6,6 +6,7 @@ import builtins # Отправка вообще application/x-www-form-urlencoded, а не JSON'a # https://github.com/psf/requests/blob/master/requests/models.py#L508 import json +from typing import Optional import requests @@ -16,7 +17,7 @@ from yandex_music.exceptions import Unauthorized, BadRequest, NetworkError, Yand USER_AGENT = 'Yandex-Music-API' HEADERS = { - 'X-Yandex-Music-Client': 'WindowsPhone/3.20', + 'X-Yandex-Music-Client': 'YandexMusicAndroid/23020055', } reserved_names = [name.lower() for name in dir(builtins)] + ['client'] @@ -76,7 +77,7 @@ class Request: return cleaned_object - def _parse(self, json_data) -> Response: + def _parse(self, json_data) -> Optional[Response]: try: decoded_s = json_data.decode('utf-8') data = json.loads(decoded_s, object_hook=Request._object_hook)