Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

almztech-sdk (Python)

SDK oficial da Almztech para Python. Ele cobre a API de NFS-e:

  • emissão, consulta, reconsulta e cancelamento de notas, inclusive por planilha;
  • emitentes e certificados;
  • webhooks;
  • municípios homologados.

Versão beta: a API pública do SDK ainda pode mudar até a 1.0.

Instalação

pip install --pre almztech-sdk
  • Python 3.9+.
  • Sem dependências de runtime: usa urllib e json da biblioteca padrão (dá para injetar outro envio HTTP em OpcoesDoClient.envio_http).
  • Os dados são dict no formato exato do JSON da API, em camelCase, com TypedDict em almztech.modelos para o editor. Chaves com None não são enviadas.

Uso

import os
from almztech import AlmztechClient, AlmztechErroProtocoloRejeitado, AlmztechErroValidacao, filtros, ler_webhook

# A api key está no Portal (portal.almztech.com.br), em Primeiros passos. Guarde-a na configuração do seu
# sistema, nunca no código.
client = AlmztechClient(os.environ["ALMZTECH_API_KEY"])

try:
    protocolo = client.notas_fiscais.emitir({
        "identificacaoEmitente": "12345678000190",
        "enviarParaProducao": False,  # homologação (HML-...): não consome a franquia
        "notas": [{
            "rps": {"numeroRPS": "1001", "serie": "1", "tipo": "1", "dataEmissao": "2026-10-31"},
            "destinatario": {
                "cpfCnpj": "11222333000181",
                "razaoSocial": "Cliente Exemplo Ltda",
                "endereco": {"cep": "50030170", "codigoIBGEMunicipio": 2611606},
            },
            "servicos": [{"codigo": "0105", "descricao": "Licenciamento de software", "quantidade": 1,
                          "valorUnitario": 1500, "aliquotaISS": 2, "retemISS": 2}],
        }],
    })

    resultado = client.notas_fiscais.aguardar_conclusao(protocolo["protocolo"])
    for nota in resultado.get("notas", []):
        pdf = client.notas_fiscais.baixar_pdf(nota["codigoNota"])  # bytes
except AlmztechErroProtocoloRejeitado as erro:
    print("Rejeitada:", erro.protocolo.get("mensagem"))
except AlmztechErroValidacao as erro:
    print("Recusada:", erro.mensagem)

# No seu endpoint de webhook (a API não assina o payload: proteja a URL):
evento = ler_webhook(corpo_recebido)  # evento.tipo: "Emissao" | "Cancelamento" | "Rejeicao"

Consulta com filtros e paginação automática:

for nota in client.notas_fiscais.paginas(
    filtros.PRODUCAO,
    [filtros.periodo("2026-10-01", "2026-10-31"), filtros.com_status("EMITIDA")],
):
    print(nota["numeroNota"], nota["valorTotal"])

Também estão disponíveis:

  • Notas: consultar_por_numero, reconsultar, reconsultar_por_chave_acesso, cancelar, baixar_xml, baixar_modelo_planilha e importar_planilha (aceita caminho, bytes ou arquivo aberto).
  • Emitentes: client.emitentes, inclusive upload_certificado.
  • Webhooks e municípios: client.webhooks e client.municipios.

Exceções:

  • AlmztechErroValidacao (422 e 400);
  • AlmztechErroAutenticacao (401);
  • AlmztechErroAutorizacao (403);
  • AlmztechErroLimiteDeRequisicoes (429, com retry_after);
  • AlmztechErroServidor (5xx);
  • AlmztechErroRede;
  • AlmztechErroTempoDePollingEsgotado;
  • AlmztechErroProtocoloRejeitado;
  • AlmztechErroWebhook.

Só as leituras são retentadas automaticamente. emitir, cancelar e importar_planilha nunca são.

Licença

MIT, © 2026 ALMZTECH SOFTWARES LTDA. Veja LICENSE.

Metadata

Release files for almztech-sdk 0.2.0b1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for almztech-sdk 0.2.0b1
File Size Uploaded Provenance Actions
almztech_sdk-0.2.0b1.tar.gz 19.5 kB Without provenance Details for almztech_sdk-0.2.0b1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for almztech-sdk 0.2.0b1
File Interpreter ABI Platform Actions
almztech_sdk-0.2.0b1-py3-none-any.whl Python 3 none any Details for almztech_sdk-0.2.0b1-py3-none-any.whl

Total release size: 36.9 kB

Release files / almztech_sdk-0.2.0b1.tar.gz

Download URL almztech_sdk-0.2.0b1.tar.gz
Size 19.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b5ce11e8bb8580e0d34510a03d5fce1ca4d1b055fc93f04c1fc600f18fc99d0f
BLAKE2b-256 checksum
How to use checksums
72dd39cfc2462369e5de68fa622e5e110a387c698d3a3deb93338d960c7b11b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.16

Release files / almztech_sdk-0.2.0b1-py3-none-any.whl

Download URL almztech_sdk-0.2.0b1-py3-none-any.whl
Size 17.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c8823b6890b498e1babd6de092b527220eab8b3c1e2735684504069267a6bcda
BLAKE2b-256 checksum
How to use checksums
79a10ec5dd98949210681f9bc7de4002447c139c32585850f938c3518fff7876
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.16

Security for almztech-sdk 0.2.0b1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page