-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.py
85 lines (57 loc) · 2.09 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
82
83
84
85
import datetime
import json
import os
from dotenv import load_dotenv
from Santander.SantanderScrapper import SantanderScrapper
load_dotenv(verbose=True)
from Clear.ClearScrapper import ClearScrapper
from GuiaBolso.GuiaBolsoScrapper import GuiaBolsoScrapper
from Rico.RicoScrapper import RicoScrapper
from SmarttBot.SmarttBotScrapper import SmarttBotScrapper
def save_output(provider, data):
date = datetime.datetime.today().strftime('%Y-%m-%d')
time = datetime.datetime.today().strftime('%X')
dir = 'output/' + date + '/'
if not os.path.exists(dir):
os.makedirs(dir)
f = open(dir + provider + '.json', 'w')
data['date'] = date
data['time'] = time
data['label'] = provider
f.write(json.dumps(data))
f.close()
def scrap_rico():
if os.getenv("RICO_USR"):
rico_scrapper = RicoScrapper(os.getenv("RICO_USR"), os.getenv("RICO_PWD"))
res = rico_scrapper.init()
save_output('rico', res)
def scrap_clear():
if os.getenv("CLEAR_CPF"):
clear_scrapper = ClearScrapper(os.getenv("CLEAR_CPF"), os.getenv("CLEAR_PWD"), os.getenv("CLEAR_BIRTHDATE"))
res = clear_scrapper.init()
save_output('clear', res)
def scrap_smartt_bot():
if os.getenv("SMARTT_BOT_USR"):
smartt_bot_scrapper = SmarttBotScrapper(os.getenv("SMARTT_BOT_USR"), os.getenv("SMARTT_BOT_PWD"))
res = smartt_bot_scrapper.init()
save_output('smartt_bot', res)
def scrap_guiabolso():
if os.getenv("GUIABOLSO_USR"):
guiabolso_scrapper = GuiaBolsoScrapper(os.getenv("GUIABOLSO_USR"), os.getenv("GUIABOLSO_PWD"))
res = guiabolso_scrapper.init()
save_output('guiabolso', res)
def scrap_santander():
guiabolso_scrapper = SantanderScrapper(os.getenv("SANTANDER_CPF"), os.getenv("SANTANDER_PWD"),
os.getenv("SANTANDER_LAST_DIGITS"))
res = guiabolso_scrapper.init()
def scrap_all():
scrap_guiabolso()
scrap_clear()
scrap_rico()
scrap_smartt_bot()
# scrap_smartt_bot()
# scrap_clear()
# scrap_guiabolso()
scrap_all()
# scrap_rico()
# scrap_santander()