@@ -1616,12 +1616,12 @@ def stored(self, stored_credentials_str: str):
16161616 else :
16171617 try :
16181618 self .login_credentials = Authentication .LoginCredentials (
1619- typ = Authentication .AuthenticationType .Value (
1620- obj ["type" ]),
1619+ typ = obj .get ("auth_type" ) or Authentication .AuthenticationType .Value (obj ["type" ]),
16211620 username = obj ["username" ],
1622- auth_data = base64 .b64decode (obj ["credentials" ]),
1621+ auth_data = base64 .b64decode (obj . get ( "auth_data" ) or obj ["credentials" ]),
16231622 )
1624- except KeyError :
1623+ except KeyError as e :
1624+ self .logger .error ("The stored credentials must contains these keys: username, auth_type or type, auth_data or credentials" )
16251625 pass
16261626 return self
16271627
@@ -1643,23 +1643,14 @@ def stored_file(self,
16431643 pass
16441644 else :
16451645 try :
1646- # Try Python librespot format first
16471646 self .login_credentials = Authentication .LoginCredentials (
1648- typ = Authentication .AuthenticationType .Value (
1649- obj ["type" ]),
1647+ typ = obj .get ("auth_type" ) or Authentication .AuthenticationType .Value (obj ["type" ]),
16501648 username = obj ["username" ],
1651- auth_data = base64 .b64decode (obj ["credentials" ]),
1649+ auth_data = base64 .b64decode (obj . get ( "auth_data" ) or obj ["credentials" ]),
16521650 )
16531651 except KeyError :
1654- # Try Rust librespot format (auth_type as int, auth_data instead of credentials)
1655- try :
1656- self .login_credentials = Authentication .LoginCredentials (
1657- typ = obj ["auth_type" ],
1658- username = obj ["username" ],
1659- auth_data = base64 .b64decode (obj ["auth_data" ]),
1660- )
1661- except KeyError :
1662- pass
1652+ self .logger .error ("The stored credentials must contains these keys: username, auth_type or type, auth_data or credentials" )
1653+ pass
16631654 return self
16641655
16651656 def oauth (self , oauth_url_callback , success_page_content = None ) -> Session .Builder :
0 commit comments