brazilcep icon indicating copy to clipboard operation
brazilcep copied to clipboard

Add support to proxy setting

Open nicolasassi opened this issue 6 years ago • 2 comments

Sometimes is necessary to add proxies different than the local ones. I would like to be able to set this while requesting to the correios API. Thanks!

nicolasassi avatar Oct 08 '19 15:10 nicolasassi

@nicolasassi thanks. I will work in this feature.

mstuttgart avatar Oct 09 '19 00:10 mstuttgart

Nice! I think it would be a fun improvement to your already awesome solution. As I was in a rush I did it myself, but I'll paste my code here as it my help someone while you are developing the

import requests
import zeep

p = {'https': "00.00.000.000", 'http': '00.00.000.000'}

s = requests.session()
s.proxies.update(p)
t = zeep.Transport(session=s, timeout=20)
url="https://apps.correios.com.br/SigepMasterJPA/AtendeClienteService/AtendeCliente?wsdl"
client = zeep.Client(url, transport=t)
endereco = client.service.consultaCEP('22795175')

nicolasassi avatar Oct 09 '19 20:10 nicolasassi