Skip to content

Commit

Permalink
Update custom_ibge.py
Browse files Browse the repository at this point in the history
Ajuste do código (conforme sugerido em urllib3/urllib3#2653), para evitar erro "UNSAFE_LEGACY_RENEGOTIATION_DISABLED"
  • Loading branch information
heber-augusto authored Jul 17, 2023
1 parent de9f322 commit 1feb687
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions auto-get-files/ibge/custom_ibge.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
import json
import pandas as pd
import requests
from urllib3.util.ssl_ import create_urllib3_context

ctx = create_urllib3_context()
ctx.load_default_certs()
ctx.options |= 0x4 # ssl.OP_LEGACY_SERVER_CONNECT


class CustomIbge():
def __int__(self,
Expand All @@ -10,7 +16,7 @@ def __int__(self,

def get_metadata_list(self) -> list:

http = urllib3.PoolManager()
http = urllib3.PoolManager(ssl_context=ctx)

urlApiIBGE = f'https://servicodados.ibge.gov.br/api/v3/agregados/{self.agregador}/metadados'
response = http.request('GET', urlApiIBGE)
Expand All @@ -31,7 +37,7 @@ def get_metadata_list(self) -> list:

def get_files_to_download(self, ids):

http = urllib3.PoolManager()
http = urllib3.PoolManager(ssl_context=ctx)

lista_resultados = []

Expand Down

0 comments on commit 1feb687

Please sign in to comment.