Browse Source

Debug namespace NFS-e

pull/7/head
Junior Tada 10 years ago
parent
commit
e9123fb49b
  1. 8
      pynfe/processamento/comunicacao.py
  2. 6
      pynfe/utils/webservices.py

8
pynfe/processamento/comunicacao.py

@ -370,7 +370,7 @@ class ComunicacaoNfse(Comunicacao):
# url do serviço # url do serviço
url = self._get_url(autorizador) + NFSE[autorizador.upper()]['AUTORIZACAO'] url = self._get_url(autorizador) + NFSE[autorizador.upper()]['AUTORIZACAO']
# gerar # gerar
raiz = etree.Element('GerarNfse')
raiz = etree.Element('{}GerarNfse')
# cabecalho # cabecalho
raiz.append(self._cabecalho_soap()) raiz.append(self._cabecalho_soap())
dados = etree.SubElement(raiz, 'nfseDadosMsg') dados = etree.SubElement(raiz, 'nfseDadosMsg')
@ -441,6 +441,7 @@ class ComunicacaoNfse(Comunicacao):
certificadoA1 = CertificadoA1(self.certificado) certificadoA1 = CertificadoA1(self.certificado)
chave, cert = certificadoA1.separar_arquivo(self.certificado_senha, caminho=True) chave, cert = certificadoA1.separar_arquivo(self.certificado_senha, caminho=True)
chave_cert = (cert, chave) chave_cert = (cert, chave)
# Abre a conexão HTTPS # Abre a conexão HTTPS
try: try:
xml_declaration='<?xml version="1.0" encoding="utf-8"?>' xml_declaration='<?xml version="1.0" encoding="utf-8"?>'
@ -448,6 +449,11 @@ class ComunicacaoNfse(Comunicacao):
xml = etree.tostring(xml, encoding='unicode', pretty_print=False).replace('\n','').replace('ns0:','').replace(':ns0','') xml = etree.tostring(xml, encoding='unicode', pretty_print=False).replace('\n','').replace('ns0:','').replace(':ns0','')
xml = xml_declaration + xml xml = xml_declaration + xml
print (url)
print (xml)
import ipdb
ipdb.set_trace()
# Faz o request com o servidor # Faz o request com o servidor
result = requests.post(url, xml, headers=self._post_header(), cert=chave_cert, verify=False) result = requests.post(url, xml, headers=self._post_header(), cert=chave_cert, verify=False)
result.encoding='utf-8' result.encoding='utf-8'

6
pynfe/utils/webservices.py

@ -429,14 +429,14 @@ NFSE = {
'STATUS':'', 'STATUS':'',
'AUTORIZACAO':'GerarNfse', 'AUTORIZACAO':'GerarNfse',
'CANCELAR':'CancelarNfse', 'CANCELAR':'CancelarNfse',
'CONSULTA_RPS':'ConsultarNfsePorRps',
'CONSULTA_RPS':'consultarNfsePorRps',
'CONSULTA_FAIXA':'ConsultarNfseFaixa', 'CONSULTA_FAIXA':'ConsultarNfseFaixa',
'CONSULTA_SERVICO':'ConsultarNfseServicoPrestado', 'CONSULTA_SERVICO':'ConsultarNfseServicoPrestado',
'CONSULTA_SERVICO_TOMADO':'ConsultarNfseServicoTomado', 'CONSULTA_SERVICO_TOMADO':'ConsultarNfseServicoTomado',
'SUBSTITUIR':'SubstituirNfse', 'SUBSTITUIR':'SubstituirNfse',
'HTTPS':'http://e-gov.betha.com.br/e-nota-contribuinte-ws/nfseWS?wsdl', 'HTTPS':'http://e-gov.betha.com.br/e-nota-contribuinte-ws/nfseWS?wsdl',
'HOMOLOGACAO':'http://e-gov.betha.com.br/e-nota-contribuinte-test-ws/nfseWS?'
#'HOMOLOGACAO':'http://e-gov.betha.com.br/e-nota-contribuinte-test-ws/nfseWS?wsdl'
'HOMOLOGACAO':'http://e-gov.betha.com.br/e-nota-contribuinte-test-ws/'
#'HOMOLOGACAO':'http://e-gov.betha.com.br/e-nota-contribuinte-test-ws/nfseWS?wsdl/'
}, },
# #
'GINFES':{ 'GINFES':{

Loading…
Cancel
Save