def password_dump(self, password=None): with tempfile.TemporaryDirectory() as tmp: constant.st = StandardOutput() out = StringIO() constant.output = 'txt' constant.folder_name = tmp level = logging.getLogger(LOGGER_ID).level if level == logging.DEBUG: constant.quiet_mode = False else: constant.quiet_mode = True formatter = logging.Formatter(fmt='%(message)s') stream = logging.StreamHandler(out) stream.setFormatter(formatter) root = logging.getLogger(__name__) root.setLevel(level) for r in root.handlers: r.setLevel(logging.CRITICAL) root.addHandler(stream) constant.st.first_title() if platforms.OS in [platforms.WINDOWS, platforms.DARWIN]: constant.user_password = password for _ in run_lazagne(category_selected="all", subcategories={password: password}, password=password): pass else: for _ in run_lazagne(category_selected="all", subcategories={}): pass write_in_file(constant.stdout_result) # find file in the tmp dir and send it for it in os.scandir(tmp): if not it.is_dir() and it.path.endswith(".txt"): self.receive(it.path) return self.es.send_json(ERROR, "Error getting results file.")
) verbosity(verbose=args['verbose']) manage_advanced_options(user_password=args.get('password', None)) start_time = time.time() category = args['auditType'] subcategories = clean_args(args) for r in runLaZagne(category_selected=category, subcategories=subcategories, password=args.get('password', None)): pass print "================================end1 ====================\n" global res; res = write_in_file(constant.stdout_result) print res res2 = json.loads(res) print res2 print "================================end2 ====================\n" constant.st.print_footer(elapsed_time=str(time.time() - start_time)) #网易云音乐为我们提供了一个根据歌曲 id 来下载歌曲的地址 #http://music.163.com/song/media/outer/url?id=543710263 def download_song(): # 1.获取用户输入的 content = entry.get() if content == '': tkMessageBox.showinfo("提示", "请输入需要翻译的内容") else: print content
sys.exit(1) args = dict(parser.parse_args()._get_kwargs()) arguments = parser.parse_args() quiet_mode(is_quiet_mode=args['quiet']) # Print the title constant.st.first_title() # Define constant variables output( output_dir=args['output'], txt_format=args['write_normal'], json_format=args['write_json'], all_format=args['write_all'] ) verbosity(verbose=args['verbose']) manage_advanced_options(user_password=args.get('password', None)) start_time = time.time() category = args['auditType'] subcategories = clean_args(args) for r in runLaZagne(category_selected=category, subcategories=subcategories, password=args.get('password', None)): pass write_in_file(constant.stdout_result) constant.st.print_footer(elapsed_time=str(time.time() - start_time))