From 223aac5994637c0f664cd2d270c5d597ded5d207 Mon Sep 17 00:00:00 2001 From: Danimar Ribeiro Date: Mon, 7 Nov 2016 11:05:24 -0200 Subject: [PATCH] Fix the build for now - NFCe needs to create the urls --- pytrustnfe/Servidores.py | 11 ++++++++--- pytrustnfe/nfe/__init__.py | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/pytrustnfe/Servidores.py b/pytrustnfe/Servidores.py index d679e70..fa45bcc 100644 --- a/pytrustnfe/Servidores.py +++ b/pytrustnfe/Servidores.py @@ -68,10 +68,15 @@ SIGLA_ESTADO = { } -def localizar_url(servico, estado, mod=55, ambiente=2): +def localizar_url(servico, estado, mod='55', ambiente=2): sigla = SIGLA_ESTADO[estado] - dominio = ESTADO_WS[sigla][mod][ambiente]['servidor'] - complemento = ESTADO_WS[sigla][mod][ambiente][servico] + ws = ESTADO_WS[sigla] + if mod in ws: + dominio = ws[mod][ambiente]['servidor'] + complemento = ws[mod][ambiente][servico] + else: + dominio = ws[ambiente]['servidor'] + complemento = ws[ambiente][servico] if sigla == 'RS' and servico == WS_NFE_CADASTRO: dominio = 'cad.sefazrs.rs.gov.br' diff --git a/pytrustnfe/nfe/__init__.py b/pytrustnfe/nfe/__init__.py index c8926c4..05370ee 100644 --- a/pytrustnfe/nfe/__init__.py +++ b/pytrustnfe/nfe/__init__.py @@ -85,7 +85,7 @@ def _add_qrCode(xml, **kwargs): def _send(certificado, method, sign, **kwargs): path = os.path.join(os.path.dirname(__file__), 'templates') - modelo = kwargs['NFes'][0]['infNFe']['ide']['mod'] + modelo = '55' xmlElem_send = render_xml(path, '%s.xml' % method, True, **kwargs) if sign: # Caso for autorização temos que adicionar algumas tags tipo