Skip to main content

Sobre o Emites

O Emites é uma aplicação para emissão de notas fiscais eletrônicas de serviço sob demanda. Esta biblioteca implementa um cliente para a versão 1 de sua API

https://travis-ci.org/myfreecomm/python-emites.png?branch=master

Instalação

pip install python-emites

Exemplo de utilização

from emites_api.main import Emites

api_client = Emites(
    host='https://sandbox.emites.com.br',
    token='DD00027F4A76E4B79209ACBFBC72F68E'
)

# Cadastrar um emitente
emitter_data = {
    'email': 'financeiro@python-emites.test',
    'cnpj': '91762868000184',
    'fancy_name': 'Empresa de Testes',
    'social_reason': 'Empresa de Testes Ltda ME',
    'state_inscription': 'ISENTO',
    'city_inscription': '00000000',
    'state': 'RJ',
    'city': 'Rio de Janeiro',
    'neighborhood': 'Centro',
    'street_type': 'RUA',
    'street': 'dos testes',
    'number': 42,
    'zip_code': '20011020',
    'phone': '21000000000',
    'certificate': **<certificado da empresa codificado em base-64>**,
    'password': **<senha do certificado>**,
}
new_emitter = api_client.emitters.create(**emitter_data)

# Cadastrar um tomador
taker_data = {
    'cnpj': '91762868000184',
    'fancy_name': 'Empresa de Testes',
    'social_reason': 'Empresa de Testes Ltda ME',
    'city_inscription': '00000000',
    'state_inscription': 'ISENTO',
    'address': {
        'state': 'RJ',
        'city_code': 3304557,
        'city': 'Rio de Janeiro',
        'street_type': 'RUA',
        'street': 'dos testes',
        'number': 42,
        'neighborhood_type': 'COM',
        'neighborhood': 'Centro',
        'zip_code': '20011020',
        'country_code': '01058',
        'country': 'Brasil',
        'country_abbreviation': 'BR',
    },
    'contact': {
        'phone': '21000000000',
        'email': 'financeiro@python-emites.test',
    }
}
new_taker = api_client.takers.create(**taker_data)

# Cadastrar um modelo de valores e serviço
service_values_data = {
    'emitter_id': new_emitter.id,
    'name': u'Desenvolvimento de programas de computador',
    'city_code': 3304557,
    'service_item_code': '0105',
    'city_tax_code': '010501',
    'cnae_code': '6201-5',
    'iss_percentage': '5.00',
}
new_service_values = api_client.service_values.create(**service_values_data)

# Emitir uma nota fiscal de serviço
nfse_data = {
    'emitter_id': new_emitter.id,
    'taker_id': new_taker.id,
    'serie': 'TESTE',
    'emission_date': '2014-11-12T18:16:56Z',
    'service_values': {
        'id': new_service_values.id,
        'service_amount': '99.99',
        'deduction_amount': '0.00',
        'discount_conditioning_amount': '0.00',
        'calculation_base': '99.99',
        'nfse_liquid_amount': '99.99',
        'description': u'Testes da api do emites',
    }
}
new_nfse = api_client.nfse.create(**nfse_data)

# Adicionar uma nota fiscal de serviço a um novo lote
second_nfse_data = {
    'batch_name': u'Notas do dia 12 de Novembro de 2014',
    'emitter_id': new_emitter.id,
    'taker_id': new_taker.id,
    'serie': 'TESTE',
    'emission_date': '2014-11-12T18:20:18Z',
    'service_values': {
        'id': new_service_values.id,
        'service_amount': '99.99',
        'deduction_amount': '0.00',
        'discount_conditioning_amount': '0.00',
        'calculation_base': '99.99',
        'nfse_liquid_amount': '99.99',
        'description': u'Cliente python para a api do emites',
    }
}
second_nfse = api_client.nfse.create(**second_nfse_data)

# Obter lote
new_batch = api_client.batches.all(name=second_nfse_data['batch_name'])[0]

# Adicionar nova nfse ao lote
third_nfse_data = {
    'batch_id': new_batch.id,
    'emitter_id': new_emitter.id,
    'taker_id': new_taker.id,
    'serie': 'TESTE',
    'emission_date': '2014-11-12T18:22:34Z',
    'service_values': {
        'id': new_service_values.id,
        'service_amount': '99.99',
        'deduction_amount': '0.00',
        'discount_conditioning_amount': '0.00',
        'calculation_base': '99.99',
        'nfse_liquid_amount': '99.99',
        'description': u'Teste da manipulação de lotes',
    }
}
third_nfse = api_client.nfse.create(**third_nfse_data)

# Enviar lote
new_batch.send()

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python-emites-0.1.0.tar.gz (52.3 kB view details)

Uploaded Source

File details

Details for the file python-emites-0.1.0.tar.gz.

File metadata

  • Download URL: python-emites-0.1.0.tar.gz
  • Upload date:
  • Size: 52.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for python-emites-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f623f3b1c533ac2da98a8630e79b340fdbc427649038fd1630ad17ba42adeb76
MD5 6f12c991b2c9e2ca75a55ad60711c267
BLAKE2b-256 749a6c9ca4ec8b192710f228fcbce56b9eeb79abf437b32ef77469d7d72ba69d

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 file

0.0.5

1 file

0.0.4

1 file

0.0.3

1 file

0.0.2

1 file

0.0.1

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page