-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_process_coletas.py
More file actions
63 lines (48 loc) · 2.01 KB
/
Copy pathrun_process_coletas.py
File metadata and controls
63 lines (48 loc) · 2.01 KB
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
import argparse
from datetime import datetime
from zoneinfo import ZoneInfo
from utils.utils import LoggerCustomizado
from scrapp.run_scrapping import ScrapperRun
def run_processes(controle=None):
log = LoggerCustomizado()
title = r"""
######################################################
# _____ #
# / ___/______________ _____ ____ ___ _____ #
# \__ \/ ___/ ___/ __ `/ __ \/ __ \/ _ \/ ___/ #
# ___/ / /__/ / / /_/ / /_/ / /_/ / __/ / #
# /____/\___/_/ \__,_/ .___/ .___/\___/_/ #
# /_/ /_/ #
######################################################
"""
if controle is not None:
log.info(title)
# Estabelecendo horário padrão para controle
tz_brasil = ZoneInfo("America/Sao_Paulo")
hora_inicio = datetime.now(tz=tz_brasil)
hora_inicio_geral = datetime.now(tz=tz_brasil)
log.info(f"Iniciando o processamento: '{hora_inicio_geral}'")
log.info("Scrapping de informações...")
go_scrapp = ScrapperRun(log,
controle)
go_scrapp.executa_scrapping()
end_time = datetime.now(tz=tz_brasil)
log.info(
f"Scrapping finalizado com sucesso em: {end_time - hora_inicio}")
end_time = datetime.now(tz=tz_brasil)
log.info(f"Processamento finalizado em: {end_time - hora_inicio}")
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--news", action="store_true")
parser.add_argument("--indices", action="store_true")
parser.add_argument("--cotacoes", action="store_true")
parser.add_argument("--fechamentos", action="store_true")
args = parser.parse_args()
if args.news:
run_processes("news")
elif args.indices:
run_processes("indices")
elif args.cotacoes:
run_processes("cotacoes")
elif args.fechamentos:
run_processes("fechamentos")