def new_user_command(self, cred_dict): filePath = self.getFPath() os.chdir(filePath) user_info = open("user_info.txt", "w") for key, val in cred_dict.iteritems(): user_info.write(key + ": " + val + "\n") self.credentials = cred_dict spring_app.main(['Hours'], self)
def verify_usr(self, creds): fpath = self.getFPath() try: os.chdir(fpath) with open("user_info.txt") as f: info_list = f.read().splitlines() if len(info_list) > 2: for i in info_list: tupe = i.split(": ") creds[tupe[0]] = tupe[1] self.credentials = creds spring_app.main(['Hours'], self) except IOError: spring_app.main(['UserName', 'Password'], self)