Browse Source

Finalizado a parte de emissão de NFSe Floripa

pull/86/head
Danimar Ribeiro 8 years ago
parent
commit
78b0e47dfb
  1. 16
      pytrustnfe/nfse/floripa/__init__.py
  2. 2
      setup.py

16
pytrustnfe/nfse/floripa/__init__.py

@ -50,17 +50,12 @@ def _get_oauth_token(**kwargs):
def _send(certificado, method, **kwargs): def _send(certificado, method, **kwargs):
if kwargs['ambiente'] == 'producao': 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: else:
url = 'https://nfps-e-hml.pmf.sc.gov.br/api/v1/processamento/notas/processa' url = 'https://nfps-e-hml.pmf.sc.gov.br/api/v1/processamento/notas/processa'
xml_send = kwargs['xml'] xml_send = kwargs['xml']
base = dict(
ambiente='homologacao', client_id="trustcode-tecnologia-client",
secret_id="", username="",
password=""
)
token = _get_oauth_token(**kwargs) token = _get_oauth_token(**kwargs)
kwargs.update({"numero": 1, 'access_token': token["access_token"]}) kwargs.update({"numero": 1, 'access_token': token["access_token"]})
@ -68,16 +63,13 @@ def _send(certificado, method, **kwargs):
headers = {"Accept": "application/xml", headers = {"Accept": "application/xml",
"Authorization": "Bearer %s" % kwargs['access_token']} "Authorization": "Bearer %s" % kwargs['access_token']}
r = requests.post(url, headers=headers, data=xml_send) 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 { return {
'sent_xml': xml_send, 'sent_xml': xml_send,
'received_xml': response, 'received_xml': response,
'object': obj
'object': obj,
'status_code': r.status_code,
} }

2
setup.py

@ -1,7 +1,7 @@
# coding=utf-8 # coding=utf-8
from setuptools import setup, find_packages from setuptools import setup, find_packages
VERSION = "0.9.2"
VERSION = "0.9.5"
setup( setup(
name="PyTrustNFe3", name="PyTrustNFe3",

Loading…
Cancel
Save