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

"Your OAuth token is likely expired" при попытке авторизации #616

Closed
dver63 opened this issue Sep 23, 2023 · 2 comments

Comments

@dver63
Copy link

dver63 commented Sep 23, 2023

При попытке авторизации через свой аккаунт Яндекса появляется ошибка:

Traceback (most recent call last):
File "L:/1/своё/python/yandex music.py", line 5, in <module>
client = ym.Client('token').init()
File "C:\Users\1\AppData\Local\Programs\Python\Python38\lib\site-packages\yandex_music\client.py", line 70, in wrapper
result = method(*args, **kwargs)
File "C:\Users\1\AppData\Local\Programs\Python\Python38\lib\site-packages\yandex_music\client.py", line 156, in init
self.me = self.account_status()
File "C:\Users\1\AppData\Local\Programs\Python\Python38\lib\site-packages\yandex_music\client.py", line 70, in wrapper
result = method(*args, **kwargs)
File "C:\Users\1\AppData\Local\Programs\Python\Python38\lib\site-packages\yandex_music\client.py", line 175, in account_status
result = self._request.get(url, *args, **kwargs)
File "C:\Users\1\AppData\Local\Programs\Python\Python38\lib\site-packages\yandex_music\utils\request.py", line 263, in get
result = self._request_wrapper(
File "C:\Users\1\AppData\Local\Programs\Python\Python38\lib\site-packages\yandex_music\utils\request.py", line 231, in _request_wrapper
raise UnauthorizedError(message)
yandex_music.exceptions.UnauthorizedError: {'name': 'session-expired', 'message': 'Your OAuth token is likely expired'}

Код:
import yandex_music as ym
token = 'токен из ссылки'
client = ym.Client('token').init()
client.users_likes_tracks()[0].fetch_track().download('example.mp3')

@MarshalX
Copy link
Owner

@dver63 вы передаете токен как строку ('token'), а не как переменную (token)

@dver63
Copy link
Author

dver63 commented Sep 23, 2023

не заметил, спасибо

@dver63 dver63 closed this as completed Sep 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants