Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

Commit

Permalink
Corrigindo tratamento do loop
Browse files Browse the repository at this point in the history
  • Loading branch information
caputchinefrobles committed Sep 18, 2020
1 parent c754d83 commit a8823de
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,14 @@ def processar(self, jornal, pagina_inicio=1, pagina_fim=1100, extra=False):

print ("Seção {0}, Página {1}".format(jornal, pagina))
print(full_url)
response = http.request('GET', full_url, headers=header)


try:
response = http.request('GET', full_url, headers=header)
except urllib3.exceptions.HostChangedError:
continue
except:
break

if response.headers['Content-Type'] == 'application/pdf':
buff = response.data
arquivo = io.BytesIO(buff)
Expand Down

0 comments on commit a8823de

Please sign in to comment.