-2
I need to import a table that is in html using pandas, but when trying to do this the same returns me error.
import pandas as pd
url = 'http://loterias.caixa.gov.br/wps/portal/loterias/landing/megasena/!ut/p/a1/04_Sj9CPykssy0xPLMnMz0vMAfGjzOLNDH0MPAzcDbwMPI0sDBxNXAOMwrzCjA0sjIEKIoEKnN0dPUzMfQwMDEwsjAw8XZw8XMwtfQ0MPM2I02-AAzgaENIfrh-FqsQ9wNnUwNHfxcnSwBgIDUyhCvA5EawAjxsKckMjDDI9FQE-F4ca/dl5/d5/L2dBISEvZ0FBIS9nQSEh/pw/Z7_HGK818G0K8DBC0QPVN93KQ10G1/res/id=historicoHTML/c=cacheLevelPage/=/'
tabela_megasena = pd.read_html(url)
Below is information regarding the error:
---------------------------------------------------------------------------
HTTPError Traceback (most recent call last)
<ipython-input-20-d9298fc7ed7e> in <module>()
----> 1 tabela_megasena = pd.read_html(url)
32 frames
/usr/lib/python3.7/urllib/request.py in http_error_302(self, req, fp, code, msg, headers)
743 len(visited) >= self.max_redirections):
744 raise HTTPError(req.full_url, code,
--> 745 self.inf_msg + msg, headers, fp)
746 else:
747 visited = new.redirect_dict = req.redirect_dict = {}
HTTPError: HTTP Error 302: The HTTP server returned a redirect error that would lead to an infinite loop.
The last 30x error message was:
Found
Could you give me some light and explain why this infinite loop is happening, and if possible
Go straight to the question and don’t put compliments or thanks in the posts. See: https://answall.com/help/behavior
– Augusto Vasques