Skip to main content

SDK oficial de Tilde para Python — facturación electrónica ARCA (ex AFIP) en Argentina. Server-side.

Project description

tilde-afip

SDK oficial de Tilde para Python — facturación electrónica ARCA (ex AFIP) en Argentina.

⚠️ Server-side / backend-to-backend. No uses Client Credentials en código que corra en un cliente no confiable. El client_secret nunca debe filtrarse.

Estado: alpha (0.1.0a1). API sujeta a cambios hasta 1.0.0.

Instalación

pip install tilde-afip

Requiere Python 3.10+. Sin dependencias de runtime (transport sobre la stdlib).

Quickstart

from tilde_afip import TildeClient

tilde = TildeClient(
    client_id="...",
    client_secret="...",
    environment="sandbox",        # "production" por default
    scopes=["invoicing:write"],
)

invoice = tilde.invoices.create({ ... }, idempotency_key=my_key)
print(invoice["cae"])

El token OAuth2 (client credentials) se obtiene y cachea automáticamente.

Errores tipados

from tilde_afip import TildeValidationError

try:
    tilde.invoices.create(req, idempotency_key=key)
except TildeValidationError as e:
    print(e.code, e.status, e.retryable, e.correlation_id, e.body.get("errors"))

Familias: TildeValidationError, TildeAuthenticationError, TildeAuthorizationError, TildeRateLimitError, TildeConflictError, TildeNotFoundError, TildePaymentRequiredError, TildeApiError.

Webhooks

Verificá con el raw body, antes de parsear:

from tilde_afip import construct_event

event = construct_event(
    payload=raw_body,                       # str | bytes, tal cual llegó
    signature_header=request.headers["X-Tilde-Signature"],
    secret=webhook_secret,
)
if event["type"] == "invoice.authorized":
    ...

HMAC-SHA256 en tiempo constante, con anti-replay por timestamp.

Entornos

Entorno Base URL
production https://api.tildeafip.com/v1
sandbox https://sandbox.api.tildeafip.com/v1

Acceso genérico

Cualquier endpoint de la API: tilde.request("GET", "/cuit-profiles"). El recurso invoices está tipado como ejemplo; la cobertura tipada completa se generará del contrato.

Licencia

Ver LICENSE.

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

tilde_afip-0.1.0a1.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

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

tilde_afip-0.1.0a1-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file tilde_afip-0.1.0a1.tar.gz.

File metadata

  • Download URL: tilde_afip-0.1.0a1.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for tilde_afip-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 199dbe103f9f6ca319cbe7aae8fe5a8c4b029072ad1cac594ba355ba959dd614
MD5 a61a297ba8db38eb1569d9e85024e774
BLAKE2b-256 5d3367473f9f4495ff54063eff8b53574128a86de9c37a029cccb77c0de649be

See more details on using hashes here.

File details

Details for the file tilde_afip-0.1.0a1-py3-none-any.whl.

File metadata

  • Download URL: tilde_afip-0.1.0a1-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for tilde_afip-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 0fa5f5fb33fca66986b929bdb54312a22df2e42379f6c4671679b73edbf5d6a9
MD5 1b3697afbfe0a514364a52bd339714c7
BLAKE2b-256 cc559b120e679dfdb5c8dc4d5d6885c287fbf52e449f9e5121d864bd27d8f281

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