From abf6e3b6a972301b209f8e304b8b404f8157e020 Mon Sep 17 00:00:00 2001 From: Marshal Date: Mon, 23 Dec 2019 10:14:46 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=BB=D0=B5=20account=20=D0=BF?= =?UTF-8?q?=D0=B5=D1=80=D0=B5=D0=B8=D0=BC=D0=B5=D0=BD=D0=BE=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD=D0=BE=20=D0=B2=20me=20=D0=B8=20=D1=82=D0=B5=D0=BF=D0=B5?= =?UTF-8?q?=D1=80=D1=8C=20=D1=81=D0=BE=D0=B4=D0=B5=D1=80=D0=B6=D0=B8=D1=82?= =?UTF-8?q?=20=D0=BE=D0=B1=D1=8A=D0=B5=D0=BA=D1=82=20Status,=20=D0=B2?= =?UTF-8?q?=D0=BC=D0=B5=D1=81=D1=82=D0=BE=20Account.=20=D0=94=D0=BE=D0=B1?= =?UTF-8?q?=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=20=D0=B0=D1=80=D0=B3=D1=83=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D1=82=20fetch=5Faccount=5Fstatus=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20=D0=BE=D0=BF=D1=86=D0=B8=D0=BE=D0=BD=D0=B0=D0=BB=D1=8C?= =?UTF-8?q?=D0=BD=D0=BE=D1=81=D1=82=D0=B8=20=D0=BF=D0=BE=D0=BB=D1=83=D1=87?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B8=D0=BD=D1=84=D0=BE=D1=80=D0=BC?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D0=B8=20=D0=BE=D0=B1=20=D0=B0=D0=BA=D0=BA?= =?UTF-8?q?=D0=B0=D1=83=D0=BD=D1=82=D0=B5=20=D0=BF=D1=80=D0=B8=20=D0=B8?= =?UTF-8?q?=D0=BD=D0=B8=D1=86=D0=B8=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D0=B8=20=D0=BA=D0=BB=D0=B8=D0=B5=D0=BD=D1=82=D0=B0=20#16?= =?UTF-8?q?2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yandex_music/client.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/yandex_music/client.py b/yandex_music/client.py index 82b0f51..b1862a5 100644 --- a/yandex_music/client.py +++ b/yandex_music/client.py @@ -54,18 +54,19 @@ class Client(YandexMusicObject): token (:obj:`str`): Уникальный ключ для аутентификации. base_url (:obj:`str`): Ссылка на API Yandex Music. oauth_url (:obj:`str`): Ссылка на OAuth Yandex Music. - account (:obj:`yandex_music.Account`): Объект класса :class:`yandex_music.Account` предоставляющего основную + me (:obj:`yandex_music.Status`): Объект класса :class:`yandex_music.Status` предоставляющего основную информацию об аккаунте. Args: token (:obj:`str`, optional): Уникальный ключ для аутентификации. + fetch_account_status (:obj:`bool`, optional): Получить ли информацию об аккаунте при инициализации объекта. base_url (:obj:`str`, optional): Ссылка на API Yandex Music. oauth_url (:obj:`str`, optional): Ссылка на OAuth Yandex Music. request (:obj:`yandex_music.utils.request.Request`, optional): Пре-инициализация :class:`yandex_music.utils.request.Request`. """ - def __init__(self, token=None, base_url=None, oauth_url=None, request=None): + def __init__(self, token=None, fetch_account_status=True, base_url=None, oauth_url=None, request=None): self.logger = logging.getLogger(__name__) self.token = token @@ -83,7 +84,9 @@ class Client(YandexMusicObject): else: self._request = Request(self) - self.account = self.account_status().account + self.me = None + if fetch_account_status: + self.me = self.account_status() @classmethod def from_credentials(cls, username, password, x_captcha_answer=None, x_captcha_key=None, captcha_callback=None, @@ -139,7 +142,7 @@ class Client(YandexMusicObject): :obj:`yandex_music.Client`. """ - return cls(token=token, *args, **kwargs) + return cls(token, *args, **kwargs) @log def generate_token_by_username_and_password(self, username, password, grant_type='password', x_captcha_answer=None,