-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
81 lines (69 loc) · 3.12 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
from config import config
import csv
import pandas as pd
import ssl
import sys
from report_generators.snapshot import Snapshot
from report_generators.target_url_list import TargetUrlList
from report_generators.idea import Idea
from unique_website_list.unique_website_list import generate_unique_website_list
def save_to_csv(file, data):
with open(file, 'w') as csv_file:
writer = csv.DictWriter(csv_file, fieldnames=['question', 'answer'])
writer.writeheader()
for key, value in data.items():
writer.writerow({'question': key, 'answer': value})
def generate_all_snapshot_report():
df = pd.read_csv(config['all_snapshot_url'])
snapshot_analyzer = Snapshot(df)
analysis = snapshot_analyzer.generate_report()
save_to_csv(config['all_snapshot_report_location'], analysis)
def generate_primary_snapshot_report():
df = pd.read_csv(config['primary_snapshot_url'])
snapshot_analyzer = Snapshot(df)
analysis = snapshot_analyzer.generate_report()
save_to_csv(config['primary_snapshot_report_location'], analysis)
def generate_unique_url_report():
df = pd.read_csv(config['unique_final_urls_location'])
snapshot_analyzer = Snapshot(df)
analysis = snapshot_analyzer.generate_report()
save_to_csv(config['unique_url_report_location'], analysis)
def generate_unique_websites_report():
df = pd.read_csv(config['unique_final_websites_location'])
snapshot_analyzer = Snapshot(df)
analysis = snapshot_analyzer.generate_report()
save_to_csv(config['unique_website_report_location'], analysis)
def generate_target_url_list_report():
df = pd.read_csv(config['target_url_list_url'])
target_url_list_analyzer = TargetUrlList(df)
analysis = target_url_list_analyzer.generate_report()
save_to_csv(config['target_url_list_report_location'], analysis)
def generate_idea_report():
df = pd.read_csv(config['unique_final_websites_location'])
idea_report_generator = Idea(df)
report = idea_report_generator.generate_report()
report.to_csv(config['idea_report_location'], index=False)
def generate_idea_bureau_report():
df = pd.read_csv(config['unique_final_websites_location'])
idea_report_generator = Idea(df)
report = idea_report_generator.generate_bureaus_report()
report.to_csv(config['idea_bureau_report_location'], index=False)
if __name__ == '__main__':
ssl._create_default_https_context = ssl._create_unverified_context
command = sys.argv[1]
if command == 'generate-all-snapshot-report':
generate_all_snapshot_report()
if command == 'generate-primary-snapshot-report':
generate_primary_snapshot_report()
if command == 'generate-unique-url-report':
generate_unique_url_report()
if command == 'generate-unique-websites-report':
generate_unique_websites_report()
if command == 'generate-target-url-report':
generate_target_url_list_report()
if command == 'generate-unique-website-list':
generate_unique_website_list()
if command == 'generate-idea-report':
generate_idea_report()
if command == 'generate-idea-bureau-report':
generate_idea_bureau_report()