-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
32 lines (26 loc) · 846 Bytes
/
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
from initialize import driver, base_url, location
from CDP.initialize import CDP_initialize
from core.core import get_all_chats, get_chat_history, save_chats
from generator.html.core.html_generator import generate_html
from login.login import login
from utils.utils import runtime_counter
@runtime_counter
def main():
driver.get(base_url)
chat_id = login()
all_chats = get_all_chats(chat_id)
chat_history = get_chat_history(all_chats)
save_chats(chat_history)
generate_html(location)
if __name__ == "__main__":
try:
CDP_initialize()
main()
except (Exception, KeyboardInterrupt) as err:
if type(err) is KeyboardInterrupt:
err = "Interrupted"
print("\nError:", err)
exit()
finally:
print("\nWait for the WebDriver to quit")
driver.quit()