From bf03d54107a53ab7aad98cda99238c128f7e2396 Mon Sep 17 00:00:00 2001 From: Danimar Ribeiro Date: Mon, 14 Jan 2019 20:41:59 -0200 Subject: [PATCH 1/2] [VERSION] Increment pytest version to fix build --- requirements.txt | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 63f4786..3682b61 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,7 +12,7 @@ pyOpenSSL >= 16.0.0, < 18 certifi >= 2015.11.20.1 xmlsec >= 1.3.3 reportlab -pytest +pytest>=4.1.1 pytest-cov pytz zeep diff --git a/setup.py b/setup.py index 3c07021..2101389 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages -VERSION = "1.0.30" +VERSION = "1.0.31" setup( From 945dd77beae8818ab7382b90426a5de159113287 Mon Sep 17 00:00:00 2001 From: marinaGD <36993009+marinaGD@users.noreply.github.com> Date: Tue, 15 Jan 2019 11:43:16 -0200 Subject: [PATCH 2/2] [FIX] nfeInutilizacaoCE url (#211) * fix CE url in patch * flake8 * verifiy environment before choose URI --- pytrustnfe/nfe/__init__.py | 2 +- pytrustnfe/nfe/patch.py | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/pytrustnfe/nfe/__init__.py b/pytrustnfe/nfe/__init__.py index f1bfc52..8395f24 100644 --- a/pytrustnfe/nfe/__init__.py +++ b/pytrustnfe/nfe/__init__.py @@ -92,7 +92,7 @@ def _send(certificado, method, **kwargs): session = _get_session(certificado) patch = has_patch(kwargs['estado'], method) if patch: - return patch(session, xml_send) + return patch(session, xml_send, kwargs['ambiente']) transport = Transport(session=session) first_op, client = _get_client(base_url, transport) return _send_zeep(first_op, client, xml_send) diff --git a/pytrustnfe/nfe/patch.py b/pytrustnfe/nfe/patch.py index 6ca85ef..a354b21 100644 --- a/pytrustnfe/nfe/patch.py +++ b/pytrustnfe/nfe/patch.py @@ -2,7 +2,7 @@ from ..Servidores import SIGLA_ESTADO from pytrustnfe.xml import sanitize_response -def nfeInutilizacaoCE(session, xml_send): +def nfeInutilizacaoCE(session, xml_send, ambiente): soap = '\ ' + xml_send + '' @@ -10,9 +10,14 @@ def nfeInutilizacaoCE(session, xml_send): 'SOAPAction': "", 'Content-Type': 'application/soap+xml; charset="utf-8"' } - response = session.post( - 'https://nfeh.sefaz.ce.gov.br/nfe4/services/NFeInutilizacao4', - data=soap, headers=headers) + if ambiente == 1: + response = session.post( + 'https://nfe.sefaz.ce.gov.br/nfe4/services/NFeInutilizacao4', + data=soap, headers=headers) + else: + response = session.post( + 'https://nfeh.sefaz.ce.gov.br/nfe4/services/NFeInutilizacao4', + data=soap, headers=headers) response, obj = sanitize_response(response.text) return { 'sent_xml': xml_send,