From 6445ec5d451faf45f00a93f8c50ea9fde1436b25 Mon Sep 17 00:00:00 2001 From: Gabriel Balog Date: Fri, 10 Nov 2017 10:49:44 -0200 Subject: [PATCH 1/4] Correcao de retorno da prefeitura NFS-e --- pytrustnfe/xml/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pytrustnfe/xml/__init__.py b/pytrustnfe/xml/__init__.py index bef5a53..c49bc59 100644 --- a/pytrustnfe/xml/__init__.py +++ b/pytrustnfe/xml/__init__.py @@ -46,6 +46,7 @@ def render_xml(path, template_name, remove_empty, **nfe): def sanitize_response(response): + response = re.sub('encoding="UTF-8"', '', response) tree = etree.fromstring(response) # Remove namespaces inuteis na resposta for elem in tree.getiterator(): From 6c3a9cbd838510ac25172a850c21bd826e049118 Mon Sep 17 00:00:00 2001 From: Unknown Date: Fri, 2 Feb 2018 15:29:08 -0200 Subject: [PATCH 2/4] 3: Auto stash before merge of "master3" and "origin/master3" --- pytrustnfe/xml/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytrustnfe/xml/__init__.py b/pytrustnfe/xml/__init__.py index 02c4d76..967ed0c 100644 --- a/pytrustnfe/xml/__init__.py +++ b/pytrustnfe/xml/__init__.py @@ -7,7 +7,7 @@ from lxml import etree from lxml import objectify from jinja2 import Environment, FileSystemLoader from . import filters - +import re def recursively_empty(e): if e.text: From e98d493faea42bdb732677a6b41a15e435e65a26 Mon Sep 17 00:00:00 2001 From: Gabriel Balog Date: Thu, 8 Feb 2018 11:01:04 -0200 Subject: [PATCH 3/4] 3: Auto stash before merge of "master3" and "origin/master3" --- pytrustnfe/utils.py | 2 ++ pytrustnfe/xml/__init__.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pytrustnfe/utils.py b/pytrustnfe/utils.py index b53ba37..40cc12e 100644 --- a/pytrustnfe/utils.py +++ b/pytrustnfe/utils.py @@ -85,6 +85,8 @@ def _find_node(xml, node): def gerar_nfeproc(envio, recibo): NSMAP = {None: 'http://www.portalfiscal.inf.br/nfe'} root = ET.Element("nfeProc", versao="3.10", nsmap=NSMAP) + if 'encoding="utf-8"' in recibo: + recibo = re.sub('encoding="utf-8"', '', recibo) docEnvio = ET.fromstring(envio) docRecibo = ET.fromstring(recibo) diff --git a/pytrustnfe/xml/__init__.py b/pytrustnfe/xml/__init__.py index 5a848b2..89279e9 100644 --- a/pytrustnfe/xml/__init__.py +++ b/pytrustnfe/xml/__init__.py @@ -58,7 +58,8 @@ def render_xml(path, template_name, remove_empty, **nfe): def sanitize_response(response): - response = re.sub('encoding="UTF-8"', '', response) + if 'encoding="utf-8"' in response or 'encoding="UTF-8"' in response: + response = re.sub('encoding="UTF-8"', '', response) tree = etree.fromstring(response) # Remove namespaces inuteis na resposta for elem in tree.getiterator(): From f352e9653d76888dae254f12394553abc3d76c4a Mon Sep 17 00:00:00 2001 From: Gabriel Balog Date: Thu, 8 Feb 2018 11:30:02 -0200 Subject: [PATCH 4/4] =?UTF-8?q?[FIX]=20Corre=C3=A7=C3=A3o=20na=20volta=20d?= =?UTF-8?q?a=20prefeitura?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pytrustnfe/xml/__init__.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/pytrustnfe/xml/__init__.py b/pytrustnfe/xml/__init__.py index 89279e9..cc1907e 100644 --- a/pytrustnfe/xml/__init__.py +++ b/pytrustnfe/xml/__init__.py @@ -58,8 +58,6 @@ def render_xml(path, template_name, remove_empty, **nfe): def sanitize_response(response): - if 'encoding="utf-8"' in response or 'encoding="UTF-8"' in response: - response = re.sub('encoding="UTF-8"', '', response) tree = etree.fromstring(response) # Remove namespaces inuteis na resposta for elem in tree.getiterator():