def check_login(self, u, p): """ Verifies a user's login credentials. Returns true or false and a message. """ logger.debug("Entering") try: val = login.validate_user(u, p) except ValueError as e: logger.debug("Exiting - failure") return False, e.message if val: logger.debug("Exiting - success") return True, "Login successful!" else: logger.debug("Exiting - failure") return False, "Login failed."
import getpass if __name__ == '__main__': if (os.path.isfile("config.json") == True): with open('config.json', 'r') as f: try: config = json.load(f) except: config = {} else: config = {} config["uid"] = input("spotify username: "******"name"] = input("name: ") config["email"] = input("email: ") if ("client_id" not in config): config["client_id"] = input("client id: ") if ("client_secret" not in config): config["client_secret"] = input("client_secret: ") config["redirect_uri"] = "http://localhost/callback" user = gitsound.SpotifyUser(