@@ -518,9 +518,10 @@ def build(self) -> EventService.EventBuilder:
518518 raise NotImplementedError
519519
520520 class EventBuilder :
521- body = io .BytesIO ()
521+ body : io .BytesIO
522522
523523 def __init__ (self , event_type : EventService .Type ):
524+ self .body = io .BytesIO ()
524525 self .append_no_delimiter (event_type .value [0 ])
525526 self .append (event_type .value [1 ])
526527
@@ -580,21 +581,21 @@ class Session(Closeable, MessageListener, SubListener):
580581 scheduler = sched .scheduler (time .time )
581582 __api : ApiClient
582583 __ap_welcome : Authentication .APWelcome
583- __audio_key_manager : typing .Union [AudioKeyManager , None ]
584+ __audio_key_manager : typing .Union [AudioKeyManager , None ] = None
584585 __auth_lock = threading .Condition ()
585586 __auth_lock_bool = False
586587 __cache_manager : typing .Union [CacheManager , None ]
587588 __cdn_manager : typing .Union [CdnManager , None ]
588- __channel_manager : typing .Union [ChannelManager , None ]
589+ __channel_manager : typing .Union [ChannelManager , None ] = None
589590 __client : typing .Union [requests .Session , None ]
590591 __closed = False
591592 __closing = False
592593 __content_feeder : typing .Union [PlayableContentFeeder , None ]
593- __dealer_client : typing .Union [DealerClient , None ]
594- __event_service : typing .Union [EventService , None ]
594+ __dealer_client : typing .Union [DealerClient , None ] = None
595+ __event_service : typing .Union [EventService , None ] = None
595596 __keys : DiffieHellman
596597 __mercury_client : MercuryClient
597- __receiver : typing .Union [Receiver , None ]
598+ __receiver : typing .Union [Receiver , None ] = None
598599 __search : typing .Union [SearchManager , None ]
599600 __server_key = b"\xac \xe0 F\x0b \xff \xc2 0\xaf \xf4 k\xfe \xc3 \xbf \xbf \x86 =" \
600601 b"\xa1 \x91 \xc6 \xcc 3l\x93 \xa1 O\xb3 \xb0 \x16 \x12 \xac \xac j" \
@@ -1004,6 +1005,7 @@ def __authenticate_partial(self,
10041005 elif packet .is_cmd (Packet .Type .auth_failure ):
10051006 ap_login_failed = Keyexchange .APLoginFailed ()
10061007 ap_login_failed .ParseFromString (packet .payload )
1008+ self .close ()
10071009 raise Session .SpotifyAuthenticationException (ap_login_failed )
10081010 else :
10091011 raise RuntimeError ("Unknown CMD 0x" + packet .cmd .hex ())
@@ -1056,7 +1058,10 @@ def set_device_type(
10561058 return self
10571059
10581060 class Accumulator :
1059- __buffer = io .BytesIO ()
1061+ __buffer : io .BytesIO
1062+
1063+ def __init__ (self ):
1064+ self .__buffer = io .BytesIO ()
10601065
10611066 def read (self ) -> bytes :
10621067 """
@@ -1433,10 +1438,11 @@ def build(self) -> Session.Configuration:
14331438 )
14341439
14351440 class ConnectionHolder :
1436- __buffer = io .BytesIO ()
1441+ __buffer : io .BytesIO
14371442 __socket : socket .socket
14381443
14391444 def __init__ (self , sock : socket .socket ):
1445+ self .__buffer = io .BytesIO ()
14401446 self .__socket = sock
14411447
14421448 @staticmethod
0 commit comments