Skip to main content

kodebar

SDK oficial da API Kodebar — consulta de produtos brasileiros por código de barras (GTIN/EAN).

Instalação

pip install kodebar

Uso rápido

from kodebar import Kodebar

kb = Kodebar("sua-api-key")

# Consultar um produto
produto = kb.lookup("7891234567890")
print(produto["nome"])       # "Produto Exemplo 500ml"
print(produto["thumbnail"])  # URL da imagem

# Buscar por nome
busca = kb.search("arroz integral")
for p in busca["results"]:
    print(p["gtin"], p["nome"])

# Autocomplete
sugestoes = kb.autocomplete("coca")

# Consulta em lote
lote = kb.bulk(["7891234567890", "7898765432100"])
print(f'{lote["found"]} encontrados, {lote["missed"]} não encontrados')

Configuração

kb = Kodebar("sua-api-key",
    timeout=15,       # timeout em segundos (default: 10)
    max_retries=3,    # retries em 429/5xx (default: 2)
)

Métodos

Método Descrição Tier mínimo
lookup(gtin) Consulta por GTIN/EAN Teste (grátis)
search(query, limit=, offset=) Busca por nome Básico
autocomplete(query, limit=) Autocomplete rápido Básico
bulk(gtins) Consulta em lote Básico
me() Info da conta Teste
usage(days=30) Histórico de uso Teste
logs(limit=50) Últimas consultas Teste
resolved_misses(days=, limit=) Misses resolvidos Básico
list_webhooks() Lista webhooks Básico
create_webhook(url, event=) Cria webhook Básico
delete_webhook(id) Remove webhook Básico

Tratamento de erros

from kodebar import Kodebar, KodebarNotFoundError, KodebarRateLimitError

kb = Kodebar("sua-api-key")

try:
    produto = kb.lookup("0000000000000")
except KodebarNotFoundError as e:
    print(f"Produto não encontrado: {e.gtin}")
except KodebarRateLimitError as e:
    print(f"Rate limit! Tente novamente em {e.retry_after} segundos")
except KodebarError as e:
    print(f"Erro: {e} (status: {e.status})")

Crie sua conta grátis

kodebar.korvensistemas.com.br/painel

Licença

MIT

Release files for kodebar 0.1.0

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

Source distribution (sdist)

Source distribution for kodebar 0.1.0
File Size Uploaded
kodebar-0.1.0.tar.gz 4.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kodebar 0.1.0
File Interpreter ABI Platform
kodebar-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.3 kB

Release files / kodebar-0.1.0.tar.gz

Download URL kodebar-0.1.0.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
a9ca9e125355f2b6763c68f45f4cbb5d20f86aa58bd34a199e53fe2a8003b3b5
BLAKE2b-256 checksum
How to use checksums
da588b7595c8ceb125e3563a4454d4259bf9b8d8b55f89e0dc7b2b81dea0399f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / kodebar-0.1.0-py3-none-any.whl

Download URL kodebar-0.1.0-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5998bb24c53f7acda7c37722e1a31e1ca45ed884a14773c183b9eb0aca751f58
BLAKE2b-256 checksum
How to use checksums
c69452b3f1cf07e28dcfa7d2117637390a1d68a03e964bf9012f5751e4c4917b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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