turicas/eleicoes-brasil

[ERRO] ConnectionError: HTTPConnectionPool(host='agencia.tse.jus.br', port=80): Read timed out.

evertoncbx opened this issue · 0 comments

Ao tentar executar a extração da votação de 2018 foi apresentado o seguinte erro

python tse.py votacao-zona --years=2018

`VotacaoZona 2018
Downloading file: 35%|████████████████████ | 276M/796M [05:23<10:08, 854kbytes/s]Traceback (most recent call last):
File "D:\dataScience\anaconda\lib\site-packages\urllib3\response.py", line 436, in _error_catcher
yield
File "D:\dataScience\anaconda\lib\site-packages\urllib3\response.py", line 518, in read
data = self._fp.read(amt) if not fp_closed else b""
File "D:\dataScience\anaconda\lib\http\client.py", line 458, in read
n = self.readinto(b)
File "D:\dataScience\anaconda\lib\http\client.py", line 502, in readinto
n = self.fp.readinto(b)
File "D:\dataScience\anaconda\lib\socket.py", line 669, in readinto
return self._sock.recv_into(b)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\dataScience\anaconda\lib\site-packages\requests\models.py", line 751, in generate
for chunk in self.raw.stream(chunk_size, decode_content=True):
File "D:\dataScience\anaconda\lib\site-packages\urllib3\response.py", line 575, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "D:\dataScience\anaconda\lib\site-packages\urllib3\response.py", line 540, in read
raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
File "D:\dataScience\anaconda\lib\contextlib.py", line 131, in exit
self.gen.throw(type, value, traceback)
File "D:\dataScience\anaconda\lib\site-packages\urllib3\response.py", line 441, in _error_catcher
raise ReadTimeoutError(self._pool, None, "Read timed out.")
urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='agencia.tse.jus.br', port=80): Read timed out.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "tse.py", line 209, in
extract_data(
File "tse.py", line 41, in extract_data
result = extractor.download(year, force=force_redownload)
File "D:\dataScience\perfil_Parlamentar\eleicoes-brasil-master\extractors.py", line 239, in download
file_data = download_file(url, progress=True, chunk_size=256 * 1024)
File "D:\dataScience\anaconda\lib\site-packages\rows\utils_init_.py", line 447, in download_file
for data in response.iter_content(chunk_size=chunk_size):
File "D:\dataScience\anaconda\lib\site-packages\requests\models.py", line 758, in generate
raise ConnectionError(e)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='agencia.tse.jus.br', port=80): Read timed out.
Downloading file: 35%|███▍ | 276M/796M [05:28<10:18, 841kbytes/s]`

É um time-out do cógido request, estou verificando como posso aumentar o time-out para permitir a captura de grandes conjuntos de dados