From 7b31a2f78fb18c563ed75a5fe4493c684fde5207 Mon Sep 17 00:00:00 2001 From: Danimar Ribeiro Date: Tue, 12 Sep 2017 19:42:42 -0300 Subject: [PATCH] Removendo print - Ajustando encodings --- pytrustnfe/nfe/__init__.py | 2 +- pytrustnfe/nfe/comunicacao.py | 3 +-- pytrustnfe/xml/__init__.py | 1 - tests/test_xml_serializacao.py | 1 - 4 files changed, 2 insertions(+), 5 deletions(-) diff --git a/pytrustnfe/nfe/__init__.py b/pytrustnfe/nfe/__init__.py index b2daec2..9854047 100644 --- a/pytrustnfe/nfe/__init__.py +++ b/pytrustnfe/nfe/__init__.py @@ -189,7 +189,7 @@ def _send(certificado, method, sign, **kwargs): send_raw=send_raw) return { 'sent_xml': xml_send, - 'received_xml': response, + 'received_xml': response.decode(), 'object': obj } diff --git a/pytrustnfe/nfe/comunicacao.py b/pytrustnfe/nfe/comunicacao.py index df15ddd..08a7a6a 100644 --- a/pytrustnfe/nfe/comunicacao.py +++ b/pytrustnfe/nfe/comunicacao.py @@ -10,7 +10,6 @@ from ..xml import sanitize_response def _soap_xml(body, cabecalho): - print(type(body)) xml = '' xml += '' xml += '' @@ -32,4 +31,4 @@ def executar_consulta(certificado, url, cabecalho, xmlEnviar, send_raw=False): xml = '' + xmlEnviar.rstrip('\n') xml_enviar = xml xml_retorno = client.post_soap(xml_enviar, cabecalho) - return sanitize_response(xml_retorno) + return sanitize_response(xml_retorno.encode()) diff --git a/pytrustnfe/xml/__init__.py b/pytrustnfe/xml/__init__.py index 3bc6321..bef5a53 100644 --- a/pytrustnfe/xml/__init__.py +++ b/pytrustnfe/xml/__init__.py @@ -46,7 +46,6 @@ def render_xml(path, template_name, remove_empty, **nfe): def sanitize_response(response): - print(response) tree = etree.fromstring(response) # Remove namespaces inuteis na resposta for elem in tree.getiterator(): diff --git a/tests/test_xml_serializacao.py b/tests/test_xml_serializacao.py index 82f3dbc..3f06e14 100644 --- a/tests/test_xml_serializacao.py +++ b/tests/test_xml_serializacao.py @@ -29,7 +29,6 @@ class test_xml_serializacao(unittest.TestCase): path = os.path.join(os.path.dirname(__file__), 'XMLs') xml_to_clear = open(os.path.join(path, 'jinja_result.xml'), 'r').read() xml, obj = sanitize_response(xml_to_clear) - print(type(xml)) self.assertEqual(xml, xml_to_clear) self.assertEqual(obj.tpAmb, 'oi') self.assertEqual(obj.CNPJ, 'ola')