[GH-ISSUE #22] Can't create a Player instance #13

Closed
opened 2026-02-27 19:06:26 +03:00 by kerem · 4 comments
Owner

Originally created by @kelno on GitHub (Mar 12, 2025).
Original GitHub issue: https://github.com/Aran404/SpotAPI/issues/22

Traceback (most recent call last):
  File "D:\work\spotapi\test_user_auth.py", line 46, in <module>
    player = Player(instance)
             ^^^^^^^^^^^^^^^^
  File "D:\work\spotapi\spotapi\player.py", line 36, in __init__
    super().__init__(login, None)
  File "D:\work\spotapi\spotapi\status.py", line 40, in __init__
    super().__init__(login)
  File "D:\work\spotapi\spotapi\websocket.py", line 54, in __init__
    self.ws = connect(
              ^^^^^^^^
  File "C:\Python312\Lib\site-packages\websockets\sync\client.py", line 247, in connect
    sock = socket.create_connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\socket.py", line 828, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\socket.py", line 963, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.gaierror: [Errno 11001] getaddrinfo failed

Process finished with exit code 1

"gue1-dealer2.spotify.com" is not resolved for me, causing it to fail.
Replacing it with "dealer.spotify.com" allowed me to go through, create and use the player instance.

Originally created by @kelno on GitHub (Mar 12, 2025). Original GitHub issue: https://github.com/Aran404/SpotAPI/issues/22 ``` Traceback (most recent call last): File "D:\work\spotapi\test_user_auth.py", line 46, in <module> player = Player(instance) ^^^^^^^^^^^^^^^^ File "D:\work\spotapi\spotapi\player.py", line 36, in __init__ super().__init__(login, None) File "D:\work\spotapi\spotapi\status.py", line 40, in __init__ super().__init__(login) File "D:\work\spotapi\spotapi\websocket.py", line 54, in __init__ self.ws = connect( ^^^^^^^^ File "C:\Python312\Lib\site-packages\websockets\sync\client.py", line 247, in connect sock = socket.create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python312\Lib\socket.py", line 828, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python312\Lib\socket.py", line 963, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ socket.gaierror: [Errno 11001] getaddrinfo failed Process finished with exit code 1 ``` "gue1-dealer2.spotify.com" is not resolved for me, causing it to fail. Replacing it with "dealer.spotify.com" allowed me to go through, create and use the player instance.
kerem closed this issue 2026-02-27 19:06:27 +03:00
Author
Owner

@Aran404 commented on GitHub (Mar 12, 2025):

Could you provide some code to reproduce the error?

<!-- gh-comment-id:2718606918 --> @Aran404 commented on GitHub (Mar 12, 2025): Could you provide some code to reproduce the error?
Author
Owner

@kelno commented on GitHub (Mar 12, 2025):

Simple code example I made derived from your code example in the readme:

from spotapi import (
    Login,
    Config,
    NoopLogger,
    solver_clients,
    PrivatePlaylist,
    MongoSaver, JSONSaver, PlayerStatus, Player
)

cfg = Config(logger=NoopLogger())

saver = JSONSaver()

# taken from browser cookies
session_data = [{
    "identifier": "redacted@email.com",
    "cookies": {
        (...)
    }
}]

saver.save(session_data)

instance = Login.from_saver(saver, cfg, "redacted@email.com")

status = PlayerStatus(instance)
# Use https://codebeautify.org/python-formatter-beautifier to read it
print(f"All devices {status.device_ids.devices}")
print(f"Active device {status.device_ids.active_device_id}")
<!-- gh-comment-id:2719056575 --> @kelno commented on GitHub (Mar 12, 2025): Simple code example I made derived from your code example in the readme: ``` from spotapi import ( Login, Config, NoopLogger, solver_clients, PrivatePlaylist, MongoSaver, JSONSaver, PlayerStatus, Player ) cfg = Config(logger=NoopLogger()) saver = JSONSaver() # taken from browser cookies session_data = [{ "identifier": "redacted@email.com", "cookies": { (...) } }] saver.save(session_data) instance = Login.from_saver(saver, cfg, "redacted@email.com") status = PlayerStatus(instance) # Use https://codebeautify.org/python-formatter-beautifier to read it print(f"All devices {status.device_ids.devices}") print(f"Active device {status.device_ids.active_device_id}") ```
Author
Owner

@Aran404 commented on GitHub (Mar 12, 2025):

I believe you leaked your email there, I'd edit that out if I were you. But I'll have a look in a second

<!-- gh-comment-id:2719070115 --> @Aran404 commented on GitHub (Mar 12, 2025): I believe you leaked your email there, I'd edit that out if I were you. But I'll have a look in a second
Author
Owner

@Aran404 commented on GitHub (Mar 12, 2025):

Yes, it does seem they changed the websocket host. I'll push the new host. Thank you for bringing the issue to the surface.

<!-- gh-comment-id:2719079094 --> @Aran404 commented on GitHub (Mar 12, 2025): Yes, it does seem they changed the websocket host. I'll push the new host. Thank you for bringing the issue to the surface.
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/SpotAPI#13
No description provided.