def __init__(self, mail, password, token=None): self.spo = Spotify(auth=generate_token()) self.req = requests.Session() check = self.get_api("deezer.getUserData")['checkFormLogin'] post_data = { "type": "login", "mail": mail, "password": password, "checkFormLogin": check } end = self.req.post("https://www.deezer.com/ajax/action.php", post_data).text if "success" == end: print("Success, you are in :)") else: if not token: raise exceptions.BadCredentials(end + ", and no token provided") self.req.cookies['arl'] = token user_id = (self.req.get("https://www.deezer.com/").text.split( "'deezer_user_id': ")[1].split(",")[0]) if user_id == "0": raise exceptions.BadCredentials("Wrong token :(")
def __init__(self, token): self.spo = Spotify(generate_token()) self.req = Session() self.req.cookies['arl'] = token user_id = self.get_api(method_get_user)['USER']['USER_ID'] if user_id == 0: raise exceptions.BadCredentials("Wrong token: %s :(" % token)
def __init__(self, token): self.spo = Spotify(generate_token()) self.req = Session() self.req.cookies['arl'] = token user_id = (self.req.get("https://www.deezer.com/").text.split( "'deezer_user_id': ")[1].split(",")[0]) if user_id == "0": raise exceptions.BadCredentials("Wrong token: %s :(" % token)
def __init__(self, token): self.spo = utils.generate_token() self.req = Session() self.req.cookies["arl"] = token self.get_user_data = methods.method_get_user_data self.private_api_link = deezer_settings.private_api_link user_id = self.get_api(self.get_user_data)["USER"]["USER_ID"] if user_id == 0: raise exceptions.BadCredentials("Wrong token: %s :(" % token) self.qualities = deezer_settings.qualities self.songs_server = deezer_settings.songs_server self.get_song_data = methods.method_get_song_data self.get_lyric = methods.method_get_lyric self.get_album = methods.method_get_album self.get_album_data = methods.method_get_album_data self.api_track = deezer_settings.api_track self.api_album = deezer_settings.api_album self.api_playlist = deezer_settings.api_playlist