Skip to main content

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

Project description

Bling ERP API SDK

PyPI Python Versions License CI

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/

Development

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

See CONTRIBUTING.md for contribution guidelines.

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.1.0.tar.gz (428.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.1.0-py3-none-any.whl (344.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bling_erp_api-0.1.0.tar.gz
  • Upload date:
  • Size: 428.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.1.0.tar.gz
Algorithm Hash digest
SHA256 86d74bfc4133812e873f2fbd59ed47c98351c963ba82ffa3c73b6f80b035e835
MD5 825992eaa340cd87fbca2106b07106aa
BLAKE2b-256 c562e7a7f58225efac61002a28785eeb7916c5c46bfb3e7d4f0f42eed9438f15

See more details on using hashes here.

Provenance

The following attestation bundles were made for bling_erp_api-0.1.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.1.0-py3-none-any.whl.

File metadata

  • Download URL: bling_erp_api-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 344.6 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 31d012bf1bd1cfeef1541bcfbd8d45ffe4b880f22b7f4febb0e72a2bf0e24a3c
MD5 ea9fe1d6e5b96d8bfc1033921a6ebc34
BLAKE2b-256 77c4a1f0fcd86c7d28e038bab0ba6fa5c108ee531df57f6cd9f8549aa09f2cf8

See more details on using hashes here.

Provenance

The following attestation bundles were made for bling_erp_api-0.1.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