-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
33 lines (21 loc) · 741 Bytes
/
main.py
File metadata and controls
33 lines (21 loc) · 741 Bytes
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
#Como? extraí dados da web.
from selenium import webdriver as wb
browse = wb.Firefox()
numero = 1
browse.get(
"""https://www.gov.br/receitafederal/pt-br/assuntos/orientacao-tributaria/pagamentos-e-parcelamentos/taxa-de-juros-selic"""
)
for i in range(12):
numero += 1
ano = browse.find_element_by_xpath(
f"""//*[@id="parent-fieldname-text"]/table[2]/tbody/tr[1]/td[10]/b"""
).text
taxa = browse.find_element_by_xpath(
f"""//*[@id="parent-fieldname-text"]/table[2]/tbody/tr[{numero}]/td[10]"""
).text
mes = browse.find_element_by_xpath(
f"""//*[@id="parent-fieldname-text"]/table[2]/tbody/tr[{numero}]/td[1]/b"""
).text
print("-"*100)
print(f"Taxa selic em {ano}")
print(f"{mes} : {taxa}")