urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='mdfe-homologacao.svrs.rs.gov.br', port=443)
Estou tentando enviar a MDFe , e tenho o erro acima, alguém sabe como resolver, ou pode me dar um caminho ... ?
raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='mdfe-homologacao.svrs.rs.gov.br', port=443): Max retries exceeded with url: /ws/MDFeRecepcao/MDFeRecepcao.asmx (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f49c397d790>: Failed to establish a new connection: [Errno -2] Nome ou serviço desconhecido'))
De tempos em tempos acontece esse erro de DNS com os servidore do RS, depois de um tempo volta ao normal. Pra resolver rapidamente tu pode trocar para o DNS do google 8.8.8.8, ou fazer um ping para o endereço: ping mdfe-homologacao.svrs.rs.gov.br, pegar o IP retornado e colocar no seu arquivo /etc/hosts
Q estranho não mudei nada e hoje , voltou o erro : Situação: 242 Mensagem: Rejeição: Elemento mdfeCabecMsg inexistente no SOAP HeaderChave NFe
Pra isso tinha feito - a linha 247 e a 251
def _send_zeep(first_operation, client, xml_send):
240 import pudb;pu.db
241 parser = etree.XMLParser(strip_cdata=False)
242 xml = etree.fromstring(xml_send, parser=parser)
243 namespaceMDFe = xml.find(".//{http://www.portalfiscal.inf.br/mdfe}MDFe")
244 if namespaceMDFe is not None:
245 ¦ namespaceMDFe.set("xmlns", "http://www.portalfiscal.inf.br/mdfe")
246 requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
247 xml_um = etree.fromstring(
248 ¦ '<mdfeCabecMsg xmlns="http://www.portalfiscal.inf.br/mdfe/wsdl/MDFeConsulta"><cUF>SP</cUF><versaoDados>3.00</versaoDados></mdfeCabecMsg>'
249 )
250 with client.settings(raw_response=True):
251 ¦ response = client.service[first_operation](xml, _soapheaders=[xml_um])
252 ¦ response, obj = sanitize_response(response.text)
253 ¦ return {
254 ¦ ¦ "sent_xml": xml_send,
255 ¦ ¦ "received_xml": response,
256 ¦ ¦ "object": obj.Body.getchildren()[0],
257 ¦ }