Api calls post method throwing error : certificate verification

As table data is generating dynamically by JavaScript that’s why I use api calls url but throwing the above mentioned warning. Anyone’s help is appreciated.

Base_URL

My code:

import requests
import pandas as pd
import json

body = { 'tipoEmpresa': '0'}
    
headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36',
    'x-dtpc': '33$511511524_409h2vHHVRBIAIGILPJNCRGRCECUBIACWCBUEE-0e37',
    'X-Requested-With': 'XMLHttpRequest',
    'Content-Type': 'application/json'
    }

def main(url):
    with requests.Session() as req:
        req.headers.update(headers)
      
        r = req.post(url, data=json.dumps(body), headers =headers, verify = False)
        resp =  r.json()['d']
        
        #df = pd.DataFrame(resp)
        #print(df)
        

main('https://www.rad.cvm.gov.br/ENET/frmConsultaExternaCVM.aspx/PopulaComboEmpresas')

Answer

Try to add these two lines at the beginning of your script to suppress warning messages:

import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)