The Login
class handles logging in to Spotify, managing sessions, and saving login information.
-
cfg:
Config
Configuration object. -
password:
str
User's password. -
email:
Optional[str]
, optional
User's email. Defaults toNone
. -
username:
Optional[str]
, optional
User's username. Defaults toNone
.Either an email or username must be provided.
__init__(self, cfg: Config, password: str, *, email: str | None = None, username: str | None = None) -> None
Initializes the Login
class with configuration, password, and either email or username.
Saves the session with the provided Saver
.
-
Args:
saver
:SaverProtocol
The saver to save the session to.
-
Raises:
ValueError
if the session is not logged in.
Constructs a Login
instance using cookie data and configuration.
-
Args:
-
dump
:Mapping[str, Any]
The session dump. -
cfg
:Config
The configuration object.
-
-
Returns:
Login
instance. -
Raises:
ValueError
if the dump format is invalid.
Loads a session from a Saver
class.
-
Args:
-
saver
:SaverProtocol
The saver to load the session from. -
cfg
:Config
The configuration object. -
identifier
:str
The identifier of the session.
-
-
Returns:
Login
instance.
Property indicating whether the user is logged in.
Returns a string representation of the Login
instance.
Logs the user in, handling captcha if necessary.
- Raises:
LoginError
if login fails or captcha cannot be solved.
The LoginChallenge
class handles challenges encountered during login, including solving captchas and completing challenge steps.
-
login:
Login
TheLogin
instance. -
dump:
Mapping[str, Any]
The challenge data.
Initializes the LoginChallenge
class with the Login
instance and challenge data.
Defeats the login challenge by performing the necessary steps.
- Raises:
LoginError
if unable to get challenge, submit challenge, or complete challenge.