def save_cookies(self): try: write_json_into_file(self.cookies, DATA_PATH + self.cookies_filename) LOG.info("Save cookies successfully") except Exception as e: LOG.error(str(e)) LOG.error("Save cookies failed")
def save_login_info(self, login_data): if login_data['is_remember']: try: f = open(DATA_PATH + self.pw_filename, 'w') if self.is_autofill is not True: # 如果不是自动填充,说明密码时已经没有加密过 password = login_data['password'].encode('utf-8') login_data['password'] = hashlib.md5(password).hexdigest() data_json = json.dumps(login_data) write_json_into_file(data_json, f) except Exception as e: LOG.error(str(e)) else: try: os.remove(DATA_PATH + self.pw_filename) except Exception as e: LOG.warning(str(e))
def save_user_info(self, data_dict): if write_json_into_file(data_dict, DATA_PATH + self.user_info_filename): LOG.info("Save User info successfully")