Skip to content

Commit

Permalink
Refactor NFSeSoapClient
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelobelli committed Oct 27, 2018
1 parent bd54110 commit dcd0a07
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
14 changes: 0 additions & 14 deletions PyNFSe/base/cliente_comunicacao.py

This file was deleted.

13 changes: 13 additions & 0 deletions PyNFSe/base/soap_client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from requests import Session
from zeep import Client
from zeep.transports import Transport


class NFSeSoapClient(Client):

def __init__(self, url_env: str, certificate: tuple, is_production: bool=False):
session = Session()
session.cert = certificate
session.verify = is_production

super().__init__(url_env, transport=Transport(session=session))
4 changes: 2 additions & 2 deletions PyNFSe/nfse/pr/curitiba/comunicacao.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from PyNFSe.base.cliente_comunicacao import ClienteComunicacao
from PyNFSe.base.soap_client import NFSeSoapClient


class Comunicacao:

def __init__(self, url_ambiente, certificado, producao):
self._cliente = ClienteComunicacao(url_ambiente, certificado, producao)
self._cliente = NFSeSoapClient(url_ambiente, certificado, producao)

def validar_xml(self, xml):
return self._cliente.service.ValidarXml(xml)
Expand Down

0 comments on commit dcd0a07

Please sign in to comment.