Skip to content

Instantly share code, notes, and snippets.

@acras
Created August 27, 2015 17:25
Show Gist options
  • Save acras/1274e12b0d1bf885040e to your computer and use it in GitHub Desktop.
Save acras/1274e12b0d1bf885040e to your computer and use it in GitHub Desktop.
Este exemplo em Python mostra como consultar uma NFSe na API do Focus NFe
# coding=utf-8
import json
import requests
##########################################################################################
# Exemplo de consulta de NFSe no município de Sâo Paulo pela API do Focus NFe
#
# https://focusnfe.com.br/api
# Documentação: https://focusnfe.com.br/api-documentacao
#
# IMPORTANTE
# * Os dados aqui contidos devem ser alterados pelo token enviado pelo suporte técnico
# * A ref precisa ser alterada para a ref que deve ser consultada
#
##########################################################################################
#CONSTANTES da empresa e do acesso à API
url_servico = 'http://homologacao.acrasnfe.acras.com.br/nfse.json' #Para produção alterar a URL
token = '************************' #Informe o Token recebido do suporte
ref = "py0008"
#Realiza a requisição HTTP que consulta a nota para a API
print 'Consultando a Nota ref.: ' + ref
r = requests.post(url_servico + "/" + token + ".json?ref="+ ref)
print r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment