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 | C001 | E001 | 9001 | |||||||
| 0001 | C100 | E100 | 9999 | |||||||
| 0002 | C101 | E110 | ||||||||
| 0005 | C105 | E115 | ||||||||
| 0015 | C110 | |||||||||
| 0100 | C111 | |||||||||
| 0150 | C112 | |||||||||
| 0175 | C113 | |||||||||
| 0190 | C114 | |||||||||
| 0200 | C115 | |||||||||
| 0205 | C116 | |||||||||
| 0206 | C120 | |||||||||
| 0210 | C130 | |||||||||
| 0220 | C140 | |||||||||
| 0221 | C160 | |||||||||
| 0300 | C170 | |||||||||
| 0305 | C180 | |||||||||
| 0400 | C190 | |||||||||
| 0450 | C195 | |||||||||
| 0460 | C197 | |||||||||
| 0500 | ||||||||||
| 0600 | ||||||||||
| 0990 |
Project details
Release history Release notifications | RSS feed
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.7.tar.gz
(20.5 kB
view details)
File details
Details for the file pyspedfiscal-0.2.7.tar.gz.
File metadata
- Download URL: pyspedfiscal-0.2.7.tar.gz
- Upload date:
- Size: 20.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
394ccd20969aefbdc17243738465a1b39007365dde4d14225d73ae4b2a2ddddf
|
|
| MD5 |
463bd9d6805608c50fd2c7d2f83ef480
|
|
| BLAKE2b-256 |
13848fd3c4d0127d0049ea05b0c5c24d3bb02645cd132df4b7af342cfdaaf6af
|