MarshalX / yandex2spotify

Simple Python script that allow to import music from Yandex.Music to Spotify
https://yandex-music.rtfd.io
MIT License
230 stars 24 forks source link

Max retries exceeded #13

Closed karrakoliko closed 4 years ago

karrakoliko commented 4 years ago
2020-07-20 18:03:27,588 - INFO - Importing playlist ANIIML - We.Animals (2015)...
Traceback (most recent call last):
  File "importer.py", line 235, in <module>
    Importer(spotify_client_, yandex_client_, arguments.ignore).import_all()
  File "importer.py", line 192, in import_all
    item()
  File "importer.py", line 160, in import_playlists
    self._add_items_to_spotify(tracks, self.not_imported[playlist.title], save_tracks_callback, Type.TRACK)
  File "importer.py", line 100, in _add_items_to_spotify
    if item.available:
AttributeError: 'NoneType' object has no attribute 'available'
tu@inspiron3542:~/yandex2spotify$
tu@inspiron3542:~/yandex2spotify$ python3 importer.py -u vlad.turchinskiy@yandex.com -l vlad.turchinskiy@ya.ru -p db6aaeea312a1eeea2afc526051d3591
Traceback (most recent call last):
  File "/home/tu/.local/lib/python3.6/site-packages/urllib3/connection.py", line 157, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw
  File "/home/tu/.local/lib/python3.6/site-packages/urllib3/util/connection.py", line 61, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "/usr/lib/python3.6/socket.py", line 745, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Temporary failure in name resolution

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/tu/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 672, in urlopen
    chunked=chunked,
  File "/home/tu/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 376, in _make_request
    self._validate_conn(conn)
  File "/home/tu/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 994, in _validate_conn
    conn.connect()
  File "/home/tu/.local/lib/python3.6/site-packages/urllib3/connection.py", line 334, in connect
    conn = self._new_conn()
  File "/home/tu/.local/lib/python3.6/site-packages/urllib3/connection.py", line 169, in _new_conn
    self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x7f427feca2e8>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/tu/.local/lib/python3.6/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/home/tu/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 720, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "/home/tu/.local/lib/python3.6/site-packages/urllib3/util/retry.py", line 436, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.music.yandex.net', port=443): Max retries exceeded with url: /account/status (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f427feca2e8>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/tu/.local/lib/python3.6/site-packages/yandex_music/utils/request.py", line 194, in _request_wrapper
    resp = requests.request(*args, **kwargs)
  File "/home/tu/.local/lib/python3.6/site-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/tu/.local/lib/python3.6/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/tu/.local/lib/python3.6/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/home/tu/.local/lib/python3.6/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.music.yandex.net', port=443): Max retries exceeded with url: /account/status (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f427feca2e8>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "importer.py", line 229, in <module>
    yandex_client_ = Client.from_credentials(arguments.login, arguments.password, captcha_callback=proc_captcha)
  File "/home/tu/.local/lib/python3.6/site-packages/yandex_music/client.py", line 148, in from_credentials
    token = cls(*args, **kwargs).generate_token_by_username_and_password(username, password,
  File "/home/tu/.local/lib/python3.6/site-packages/yandex_music/client.py", line 118, in __init__
    self.me = self.account_status()
  File "/home/tu/.local/lib/python3.6/site-packages/yandex_music/client.py", line 34, in wrapper
    result = method(*args, **kwargs)
  File "/home/tu/.local/lib/python3.6/site-packages/yandex_music/client.py", line 262, in account_status
    result = self._request.get(url, timeout=timeout, *args, **kwargs)
  File "/home/tu/.local/lib/python3.6/site-packages/yandex_music/utils/request.py", line 239, in get
    timeout=timeout, *args, **kwargs)
  File "/home/tu/.local/lib/python3.6/site-packages/yandex_music/utils/request.py", line 198, in _request_wrapper
    raise NetworkError(e)
yandex_music.exceptions.NetworkError: HTTPSConnectionPool(host='api.music.yandex.net', port=443): Max retries exceeded with url: /account/status (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f427feca2e8>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',))
MarshalX commented 4 years ago

Perhaps because of so many authorizations. For this, there is authorization by token)

karrakoliko commented 4 years ago

Anyway this must be correctly handled

lemonpaul commented 4 years ago

Is this playlist collective?

karrakoliko commented 4 years ago

Is this playlist collective?

yes, it is public. https://clck.ru/PmRz5

lemonpaul commented 4 years ago

I mean... Are there any other owners? Did you invite friends to add tracks in this playlist?

karrakoliko commented 4 years ago

I mean... Are there any other owners? Did you invite friends to add tracks in this playlist?

no

lemonpaul commented 4 years ago
playlist = importer.yandex_client.users_playlists_list(user_id='vlad.turchinskiy')[2]
playlist.collective
Out[5]: True

Seems like you push link "Invite a friend". I don't know how to do it no collective, but such problem has already appeared.

karrakoliko commented 4 years ago
playlist = importer.yandex_client.users_playlists_list(user_id='vlad.turchinskiy')[2]
playlist.collective
Out[5]: True

Seems like you push link "Invite a friend". I don't know how to do it no collective, but such problem has already appeared.

playlist that user can create may be private (other users can't listen it) or public. may be "collective" means "public"? or this means that playlist created by user, not by YM (e.g. this is not artist's album/single, but just a some user's playlist).

there is no feature like "invite friend to create/modify playlist".

anyway, does it relate to the issue?

lemonpaul commented 4 years ago

"Collective" doesn't mean "private" or "public". It means that more than one user can add tracks in this playlist. There is such feature. Screenshot from 2020-07-20 14-17-40 It relates to this exception:

2020-07-20 18:03:27,588 - INFO - Importing playlist ANIIML - We.Animals (2015)...
Traceback (most recent call last):
  File "importer.py", line 235, in <module>
    Importer(spotify_client_, yandex_client_, arguments.ignore).import_all()
  File "importer.py", line 192, in import_all
    item()
  File "importer.py", line 160, in import_playlists
    self._add_items_to_spotify(tracks, self.not_imported[playlist.title], save_tracks_callback, Type.TRACK)
  File "importer.py", line 100, in _add_items_to_spotify
    if item.available:
AttributeError: 'NoneType' object has no attribute 'available'

But max retries exceeded exception seems like not issue for this project. Maybe for yandex-music-api.

karrakoliko commented 4 years ago

@lemonpaul ok, how about "human readable" error message and exception handling?

lemonpaul commented 4 years ago

There is exception handling from spotify, maybe there will be exception handling from yandex in future.