From 56c1deaebf133876e9cfcbda18723a33287a7919 Mon Sep 17 00:00:00 2001 From: Felipe Date: Tue, 20 Mar 2018 17:29:44 -0300 Subject: [PATCH] bug encode nfse paulistana --- pytrustnfe/nfse/paulistana/__init__.py | 4 ++-- pytrustnfe/xml/__init__.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pytrustnfe/nfse/paulistana/__init__.py b/pytrustnfe/nfse/paulistana/__init__.py index ed0611b..44019b8 100644 --- a/pytrustnfe/nfse/paulistana/__init__.py +++ b/pytrustnfe/nfse/paulistana/__init__.py @@ -54,10 +54,10 @@ def _send(certificado, method, **kwargs): 'object': None } - response, obj = sanitize_response(response) + response, obj = sanitize_response(response.encode('utf-8')) return { 'sent_xml': xml_send, - 'received_xml': response, + 'received_xml': response.decode(), 'object': obj } diff --git a/pytrustnfe/xml/__init__.py b/pytrustnfe/xml/__init__.py index 0d11eab..0ed0ee5 100644 --- a/pytrustnfe/xml/__init__.py +++ b/pytrustnfe/xml/__init__.py @@ -46,7 +46,7 @@ def render_xml(path, template_name, remove_empty, **nfe): def sanitize_response(response): - tree = etree.fromstring(response.encode('utf-8')) + tree = etree.fromstring(response) # Remove namespaces inuteis na resposta for elem in tree.getiterator(): if not hasattr(elem.tag, 'find'):