Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Не рабочий метод download_avatar() #375

Closed
Adeksi opened this issue Oct 4, 2020 · 4 comments
Closed

Не рабочий метод download_avatar() #375

Adeksi opened this issue Oct 4, 2020 · 4 comments
Assignees
Labels
bug Что-то не работает help wanted Требуется дополнительное внимание

Comments

@Adeksi
Copy link

Adeksi commented Oct 4, 2020

Опишите ошибку
Невозможно скачать аватар методом download_avatar() в классе Account
Воспроизведение
Шаги для воспроизведения бага:

  1. Создать объект client1
  2. Вызвать метод client1.client.me.account.download_avatar('avatar.png','orig')
  3. Увидеть ошибку

Ожидаемое поведение
Должен загрузится аватар пользователя.

Логи
Traceback (most recent call last):
File "/home/shamilu/.local/lib/python3.8/site-packages/yandex_music/utils/request.py", line 138, in _parse
data = json.loads(decoded_s, object_hook=Request._object_hook)
File "/usr/lib/python3.8/json/init.py", line 370, in loads
return cls(**kw).decode(s)
File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "main.py", line 271, in
print(client1.client.me.account.download_avatar('avatar.png','orig'))
File "/home/shamilu/.local/lib/python3.8/site-packages/yandex_music/account/account.py", line 97, in download_avatar
self.client.request.download(
File "/home/shamilu/.local/lib/python3.8/site-packages/yandex_music/utils/request.py", line 283, in download
result = self.retrieve(url, timeout=timeout, *args, *kwargs)
File "/home/shamilu/.local/lib/python3.8/site-packages/yandex_music/utils/request.py", line 267, in retrieve
return self._request_wrapper('GET', url, proxies=self.proxies, timeout=timeout, *args, **kwargs)
File "/home/shamilu/.local/lib/python3.8/site-packages/yandex_music/utils/request.py", line 189, in _request_wrapper
parse = self._parse(resp.content)
File "/home/shamilu/.local/lib/python3.8/site-packages/yandex_music/utils/request.py", line 145, in _parse
raise YandexMusicError('Invalid server response')
yandex_music.exceptions.YandexMusicError: Invalid server response
Дополнительная информация
Можно заменить
self.client.request.download(f'https://upics.yandex.net/{self.uid}/{format_}', filename) на что-то типо этого
self.client.request.download(f'https://avatars.mds.yandex.net/get-yapic/27503/enc-e678a2fb49ae8b1fa2ce271d79b7a16adb049a36caed38d9381db296b6d83a8f/islands-retina-middle'

@Adeksi Adeksi added the bug Что-то не работает label Oct 4, 2020
@glebliutsko glebliutsko mentioned this issue Jan 26, 2021
26 tasks
@MarshalX
Copy link
Owner

@glebliutsko баг был и исправлен в твоем ПРе?

@glebliutsko
Copy link
Contributor

glebliutsko commented Jan 27, 2021

Нет, я его перепутал с другим issue. Связь удалил, а в истории осталось видать

@MarshalX
Copy link
Owner

MarshalX commented Feb 1, 2021

Вся система с авторизацией была вынесена в отдельный сервис и SDK. Кроме получения токена для определенного приложения туда и входит менеджмент аватарок.

image

В первой запросе получения токена, во втором информация об аккаунт. В том числе avatar_url.

Ответ 1-го запроса:
image

Ответ 2-го запроса:
image

Не входит в рамки этой библиотеки, пока старый способ авторизации работает. Всё связанное с аватаркой профиля будет временно удалено

@MarshalX MarshalX added the help wanted Требуется дополнительное внимание label Feb 2, 2021
@MarshalX
Copy link
Owner

Работа с Яндекс.Паспорт (к этому относится и аватарка пользователь) больше не часть данной библиотеки

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Что-то не работает help wanted Требуется дополнительное внимание
Projects
None yet
Development

No branches or pull requests

3 participants