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

pyspedfiscal1-0.2.10.tar.gz (29.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyspedfiscal1-0.2.10-py3-none-any.whl (53.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyspedfiscal1-0.2.10.tar.gz
  • Upload date:
  • Size: 29.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pyspedfiscal1-0.2.10.tar.gz
Algorithm Hash digest
SHA256 84c873ad72029558e4ca30fe9487924d273613539cc55bc0cea9bcbf0ceb1b3a
MD5 8335c8d667a1bd1abb2c101b35196d1b
BLAKE2b-256 37e851c5225627f26e224a078f6e4e12f8eb978c8e9e55608924651f92405b2e

See more details on using hashes here.

File details

Details for the file pyspedfiscal1-0.2.10-py3-none-any.whl.

File metadata

  • Download URL: pyspedfiscal1-0.2.10-py3-none-any.whl
  • Upload date:
  • Size: 53.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pyspedfiscal1-0.2.10-py3-none-any.whl
Algorithm Hash digest
SHA256 441ec53862661c49ab33b1325ca791c8a699d94b2400f9194c501143174e48ff
MD5 ba17e751dc2a0dd3249f24bc9b79a51c
BLAKE2b-256 2e678ed4fa8ebce4c769b9b01bc8975bd82c96c66d285f1b54216aec584b13ea

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