If you don't want to use selenium
, you can use this script to load the table with requests
:
import re
import requests
from bs4 import BeautifulSoup
base_url = 'http://www.rad.cvm.gov.br/ENETCONSULTA/frmGerenciaPaginaFRE.aspx?NumeroSequencialDocumento=89180&CodigoTipoInstituicao=2'
# https://stackoverflow.com/questions/38015537/python-requests-exceptions-sslerror-dh-key-too-small
requests.packages.urllib3.disable_warnings()
requests.packages.urllib3.util.ssl_.DEFAULT_CIPHERS += ':HIGH:!DH:!aNULL'
try:
requests.packages.urllib3.contrib.pyopenssl.util.ssl_.DEFAULT_CIPHERS += ':HIGH:!DH:!aNULL'
except AttributeError:
# no pyopenssl support used / needed / available
pass
with requests.session() as s:
html_data = s.get(base_url, verify=False).text
url = 'http://www.rad.cvm.gov.br/ENETCONSULTA/' + re.search(r"window\.frames\[0\]\.location='(.*?)'", html_data).group(1)
soup = BeautifulSoup(s.get(url, verify=False).content, 'html.parser')
print(soup.table.prettify())
Prints:
<table id="ctl00_cphPopUp_tbDados">
<tr>
<td style="padding:8px 5px 8px 5px; background:#cccfd1; border-bottom:1px solid #fff !important; text-align:center; color:#ffffff; font:normal normal bold 12px 'Trebuchet MS', sans-serif;">
Conta
</td>
<td style="padding:8px 5px 8px 5px; background:#cccfd1; border-bottom:1px solid #fff !important; text-align:center; color:#ffffff; font:normal normal bold 12px 'Trebuchet MS', sans-serif;">
Descrição
</td>
<td style="padding:8px 5px 8px 5px; background:#cccfd1; border-bottom:1px solid #fff !important; text-align:center; color:#ffffff; font:normal normal bold 12px 'Trebuchet MS', sans-serif;">
01/07/2019
<br/>
a
<br/>
30/09/2019
</td>
... and so on.