From 78b0e47dfb1f3050021d1391a3e014b58d323e7e Mon Sep 17 00:00:00 2001 From: Danimar Ribeiro Date: Thu, 1 Feb 2018 01:00:36 -0200 Subject: [PATCH] =?UTF-8?q?Finalizado=20a=20parte=20de=20emiss=C3=A3o=20de?= =?UTF-8?q?=20NFSe=20Floripa?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pytrustnfe/nfse/floripa/__init__.py | 16 ++++------------ setup.py | 2 +- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/pytrustnfe/nfse/floripa/__init__.py b/pytrustnfe/nfse/floripa/__init__.py index 7dceb10..1a5de24 100644 --- a/pytrustnfe/nfse/floripa/__init__.py +++ b/pytrustnfe/nfse/floripa/__init__.py @@ -50,17 +50,12 @@ def _get_oauth_token(**kwargs): def _send(certificado, method, **kwargs): if kwargs['ambiente'] == 'producao': - url = 'https://nfps-e.pmf.sc.gov.br/api/v1/processamento/notas/processa' + url = 'https://nfps-e.pmf.sc.gov.br/api/v1/processamento/notas/processa' #noqa else: url = 'https://nfps-e-hml.pmf.sc.gov.br/api/v1/processamento/notas/processa' xml_send = kwargs['xml'] - base = dict( - ambiente='homologacao', client_id="trustcode-tecnologia-client", - secret_id="", username="", - password="" - ) token = _get_oauth_token(**kwargs) kwargs.update({"numero": 1, 'access_token': token["access_token"]}) @@ -68,16 +63,13 @@ def _send(certificado, method, **kwargs): headers = {"Accept": "application/xml", "Authorization": "Bearer %s" % kwargs['access_token']} r = requests.post(url, headers=headers, data=xml_send) - print(r.status_code) - if r.status_code != 200: - raise Exception(r.text) - print(r.text) - response, obj = sanitize_response(r.text) + response, obj = sanitize_response(r.text.strip().encode('utf-8')) return { 'sent_xml': xml_send, 'received_xml': response, - 'object': obj + 'object': obj, + 'status_code': r.status_code, } diff --git a/setup.py b/setup.py index 2ebafd0..b39eb64 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ # coding=utf-8 from setuptools import setup, find_packages -VERSION = "0.9.2" +VERSION = "0.9.5" setup( name="PyTrustNFe3",