Skip to main content

Python SDK for the Bling ERP API with auth, pagination, and helpers.

Project description

Bling ERP API SDK

PyPI version Python versions License: MIT CI Docs Downloads Code style: Ruff Type checker: basedpyright

Português (BR) | English

Unofficial Python SDK for the Bling ERP API v3.

Provides typed, idiomatic access to 40+ Bling ERP resources with sync/async transports, OAuth2 authentication, rate limiting, and automatic retry.

Installation

pip install bling-erp-api

Or with uv:

uv add bling-erp-api

Python 3.12+ required.

Quick Start

Set the required environment variables (see Authentication):

export BLING_CLIENT_ID="your_client_id"
export BLING_CLIENT_SECRET="your_client_secret"
export BLING_REFRESH_TOKEN="your_refresh_token"

Then use the SDK:

from bling_erp_api import BlingClient

with BlingClient.from_env() as client:
    # List products
    products = client.produtos.listar(limit=10)
    for product in products.get("data", []):
        print(product.get("nome"))

    # Get a contact
    contact = client.contatos.obter(1)
    print(contact)

Features

  • 40+ resource modules covering the full Bling ERP API surface
  • OAuth2 authentication via bling-jwt-auth — automatic token refresh
  • Rate limiting (3 req/s default) with 429 retry and Retry-After support
  • Typed models with Pydantic v2 — snake_case fields, automatic Bling name mapping
  • Sync and async transports
  • pt-BR canonical API with English compatibility aliases
  • OpenAPI contract validation — generated and tested against the spec
  • 500+ tests with mocked HTTP

Resources

pt-BR Namespace EN Alias Description
client.contatos client.contacts Contacts CRUD and status management
client.produtos client.products Products CRUD and status
client.produtos_estruturas client.product_structures Product structures (BOM)
client.produtos_fornecedores client.product_suppliers Product suppliers
client.produtos_lojas client.product_stores Product store mappings
client.lotes client.product_batches Product batches
client.lotes_lancamentos client.product_batch_entries Batch entries
client.produtos_variacoes client.product_variations Product variations
client.pedidos_vendas client.sales_orders Sales orders
client.pedidos_compras client.purchase_orders Purchase orders
client.notas_fiscais client.invoices NF-e (electronic invoices)
client.notas_fiscais_consumidor client.consumer_invoices NFC-e (consumer invoices)
client.notas_servicos client.service_invoices NFS-e (service invoices)
client.anuncios client.ads Marketplace ads
client.anuncios_categorias client.ad_categories Ad categories
client.caixas_bancos client.cash_entries Cash and bank entries
client.borderos client.payment_bundles Bordero management
client.categorias_lojas client.store_categories Store categories
client.categorias_produtos client.product_categories Product categories
client.categorias_receitas_despesas client.income_expense_categories Income/expense categories
client.contas_pagar client.accounts_payable Accounts payable
client.contas_receber client.accounts_receivable Accounts receivable
client.contas_contabeis client.financial_accounts Financial/chart of accounts
client.depositos client.warehouses Warehouses
client.empresas client.companies Company data
client.estoques client.stock Stock balances
client.formas_pagamentos client.payment_methods Payment methods
client.grupos_produtos client.product_groups Product groups
client.homologacao client.homologation Test/homologation
client.logisticas client.logistics Logistics providers
client.logisticas_servicos client.logistics_services Logistics services
client.logisticas_objetos client.logistics_objects Logistics objects
client.logisticas_etiquetas client.logistics_labels Shipping labels
client.logisticas_remessas client.logistics_shipments Logistics shipments
client.naturezas_operacoes client.natures_of_operations Tax natures
client.notificacoes client.notifications Notifications
client.ordens_producao client.production_orders Production orders
client.propostas_comerciais client.commercial_proposals Commercial proposals
client.situacoes client.situations Status/situations
client.situacoes_modulos client.situation_modules Situation modules
client.situacoes_transicoes client.situation_transitions Situation transitions
client.vendedores client.sellers Sellers
client.usuarios client.users User management

Authentication

The SDK uses OAuth2 (authorization code flow) delegated to the bling-jwt-auth package.

The simplest way to get started is with environment variables:

export BLING_CLIENT_ID="your_client_id"
export BLING_CLIENT_SECRET="your_client_secret"
export BLING_REFRESH_TOKEN="your_refresh_token"
export BLING_REDIRECT_URI="your_redirect_uri"  # optional

Then create a client with BlingClient.from_env().

For custom authentication, pass a token_provider implementing get_access_token() -> str or an httpx.Auth instance.

See the Authentication documentation for details.

Documentation

Full documentation is available at:

https://tempont.github.io/bling-erp-api-python/

Contributing

Contributions are welcome! See the full guide in CONTRIBUTING.md.

Quick start

git clone https://github.com/tempont/bling-erp-api-python.git
cd bling-erp-api-python
uv sync --all-groups
make check

Workflow

  1. Fork the repository
  2. Create a feature branch (git checkout -b feat/my-feature)
  3. Make your changes
  4. Verify with make check (runs ruff, basedpyright, and pytest)
  5. Commit with a clear message, push, and open a Pull Request

For detailed conventions on naming, docstrings, models, and resource implementation, see the AGENTS.md file in the repository root.

Reporting Issues

Found a bug? Use the GitHub issue tracker.

When reporting, please include:

  • Python version (python --version)
  • SDK version (bling-erp-api --version)
  • Minimal reproduction code
  • Expected vs. actual behavior

For security issues, please report privately through GitHub's security channels.

License

MIT — see 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

bling_erp_api-0.2.0.tar.gz (438.7 kB view details)

Uploaded Source

Built Distribution

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

bling_erp_api-0.2.0-py3-none-any.whl (350.7 kB view details)

Uploaded Python 3

File details

Details for the file bling_erp_api-0.2.0.tar.gz.

File metadata

  • Download URL: bling_erp_api-0.2.0.tar.gz
  • Upload date:
  • Size: 438.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bling_erp_api-0.2.0.tar.gz
Algorithm Hash digest
SHA256 755363cee86d9615b01185a43c34d218a164f200b542afe20fb34baf9b88d23a
MD5 7ba6d9588f3e0d721d162e99dd2bcd7d
BLAKE2b-256 a1a2be88afa31cc8002067c6d99e6e0bea3bcedc5848119d0435f3c1632a7711

See more details on using hashes here.

Provenance

The following attestation bundles were made for bling_erp_api-0.2.0.tar.gz:

Publisher: publish.yml on tempont/bling-erp-api-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bling_erp_api-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: bling_erp_api-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 350.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bling_erp_api-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 341c8aa19e7997f230128359d4f006bb2e2e023b93da7138ea63f74fa0f2b655
MD5 a518fad5f920ebfc7c0d2262cc789439
BLAKE2b-256 af27091833596ffebaf7f3d5bf684cf67e1830c8584de8c1f6ea4ef710f0c29c

See more details on using hashes here.

Provenance

The following attestation bundles were made for bling_erp_api-0.2.0-py3-none-any.whl:

Publisher: publish.yml on tempont/bling-erp-api-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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