def make_report(self, commented_sites): data = [] name = 'report.xlsx' for site in commented_sites: if not site['success']: continue data.append([ site['donor'].strip(), site['acceptor'].strip(), site['email'].strip(), site['author'].strip(), site['comment'].strip(), site['screenshot_before'].strip(), site['screenshot_after'].strip(), ]) column_dimensions = { 'A': {'width': 60, 'height': 50}, 'B': {'width': 60, 'height': 20}, 'C': {'width': 30, 'height': 20}, 'D': {'width': 30, 'height': 20}, 'E': {'width': 60, 'height': 20}, 'F': {'width': 60, 'height': 20}, } make_xlsx_file(name, head=['Donor', 'Acceptor', 'Email', 'Author', 'Comment', 'Screenshot Before', 'Screenshot After'], body=data, column_dimensions=column_dimensions) print('Report saved to {}!'.format(name))
def export_xlsx_report(self): cnt = {} for proces in self.processes_list: for link in proces.links: if link: h = hash(link.url + link.referer) if not h in cnt.keys(): cnt[h] = { 'site': link.url, 'refferer': link.referer, 'count': 0 } cnt[h]['count'] += link.get_requests_count() data = [[cnt[c]['site'], cnt[c]['refferer'], cnt[c]['count']] for c in cnt] file = self.saveFileDialog('report_statistic.xlsx') if file: self.qlogs.log("Saving to {} file".format(file)) make_xlsx_file(file, head=['Site', 'Refer', 'Count'], body=sorted(data, key=lambda x: x[2], reverse=True)) self.qlogs.log("Saved!")
def export_xlsx_exceptions_report(self): report = [] for exception in self.exceptions: report.append([exception['site'], str(exception['exception'])]) self.qlogs.log('Saved as report_statistic_exceptions.xlsx') make_xlsx_file('report_statistic_exceptions.xlsx', head=['Site', 'Exception'], body=report)
def export_xlsx_exceptions_report(self): report = [] for exception in self.exceptions: report.append([exception['site'], str(exception['exception'])]) file = self.saveFileDialog(name='report_statistic_exceptions.xlsx') if file: self.qlogs.log("Saving to {} file".format(file)) make_xlsx_file(file, head=['Site', 'Exception'], body=report) self.qlogs.log("Saved!")
def export_xlsx_redirects_report(self): report = [] for proces in self.processes_list: for link in proces.links: if link and link.is_redirect: report.append([link.url, link.redirect_to]) self.qlogs.log('Saved as report_statistic_redirect.xlsx') make_xlsx_file('report_statistic_redirect.xlsx', head=['Site', 'Redirect To'], body=report)
def export_xlsx_report(self): cnt = Counter() for proces in self.processes_list: for link in proces.links: if link: cnt[link.url] += link.get_requests_count() self.qlogs.log('Saved as report_statistic.xlsx') make_xlsx_file('report_statistic.xlsx', head=['Site', 'Count'], body=cnt.items())
def export_xlsx_redirects_report(self): report = [] for proces in self.processes_list: for link in proces.links: if link and link.is_redirect: report.append([link.url, link.redirect_to]) file = self.saveFileDialog(name='report_statistic_redirect.xlsx') if file: self.qlogs.log("Saving to {} file".format(file)) make_xlsx_file(file, head=['Site', 'Redirect To'], body=report) self.qlogs.log("Saved!")
def make_error_report(self, sites): data = [] name = 'error_report.xlsx' for site in sites: if site['success']: continue data.append([ site['donor'].strip(), site['error'].strip(), ]) column_dimensions = { 'A': {'width': 60, 'height': 20}, 'B': {'width': 60, 'height': 20}, } make_xlsx_file(name, head=['Donor', 'Error'], body=data, column_dimensions=column_dimensions) print('Error Report saved to {}!'.format(name))