Skip to main content

Serializa um arquivo do tipo SPED Fiscal

Project description

PySpedFiscal

Lê e serializa um arquivo do tipo Sped Fiscal

Instalação

  • pip install pyspedfiscal

Dependencias

  • Pydantic

Como Usar

Lendo um arquivo:

# Importe a classe SpedFiscal
from pyspedfiscal import SpedFiscal

# Utilize o metodo da classe `importar` para carregar um arquivo sped
sped_fiscal = SpedFiscal.importar('caminho_arquivo')

# Utilize a hierarquia do arquivo para percorrer os registros
registros_0200 = sped_fiscal.bloco_0.resgistro_0001.registros_0200

for registro in registros_0200:
  ...

Lendo um bloco:

from pyspedfiscal.bloco_0 import Bloco0

bloco = """
|0000|016|0|01072022|31072022|EMPRESA TESTE|14028298000152||SP|009371438460|3550308|||A|0|
|0001|0|
|0002|00|
|0005|EMPRESA TESTE|25821270|RUA EMPRESA TESTE|1111||BAIRRO EMPRESA TESTE|2499999999|||
...
"""

registros = bloco.splitlines()

bloco_0 = Bloco0.ler_registros(registros)

Lendo um Registro

from pyspedfiscal.bloco_0.registro_0000 import Registro0000

registro = "|0000|016|0|01072022|31072022|EMPRESA TESTE|14028298000152||SP|009371438460|3550308|||A|0|"

registro_0000 = Registro0000.ler_registro(registro)

Registros Implementados

Bloco 0 Bloco B Bloco C Bloco D Bloco E Bloco G Bloco H Bloco G Bloco K Bloco 1 Bloco 9
0000 B001 C001 E001 9001
0001 B020 C100 E100 9900
0002 B025 C101 E110 9990
0005 B030 C105 E115 9999
0015 B035 C110
0100 B350 C111
0150 B420 C112
0175 B440 C113
0190 B460 C114
0200 B470 C115
0205 B500 C116
0206 B510 C120
0210 B990 C130
0220 C140
0221 C160
0300 C170
0305 C180
0400 C190
0450 C195
0460 C197
0500
0600
0990

Project details


Download files

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

Source Distribution

pyspedfiscal-0.2.10.tar.gz (29.9 kB view details)

Uploaded Source

File details

Details for the file pyspedfiscal-0.2.10.tar.gz.

File metadata

  • Download URL: pyspedfiscal-0.2.10.tar.gz
  • Upload date:
  • Size: 29.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for pyspedfiscal-0.2.10.tar.gz
Algorithm Hash digest
SHA256 622f5460f0eb8e421f87dfb4e06166cc72f399cca451b8e0b865bdac3e4aa94b
MD5 4f9ad7144d352b303c7690c80d25b3dc
BLAKE2b-256 e4ee9e84212e0456466948cba82737752da735873a623e2779e12d41229f0487

See more details on using hashes here.

Supported by

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