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