Skip to main content

Cliente Python simples e direto para a API da Nuvemshop.

Project description

🧰 nuvemshop-client-python

Cliente Python simples e direto para a API da Nuvemshop.
Feito para ser usado em integrações, scripts ou SDKs com foco em organização, reuso e fácil manutenção.


🚀 Funcionalidades

  • ✅ Cliente HTTP com tratamento de erros e autenticação
  • ✅ Recursos separados por módulo (Products, Orders, Customers)
  • ✅ Factory embutida no client (client.products.list(), etc)
  • ✅ Base genérica para criar novos recursos rapidamente
  • ✅ Projeto modular com suporte a instalação via pip (pip install -e .)

📦 Instalação

git clone https://github.com/Brunohvg/nuvemshop-client-python.git
cd nuvemshop-client-python
pip install -e src
#uv pip install -e .

🔧 Como usar

from nuvemshop_client import NuvemshopClient

client = NuvemshopClient("seu_store_id", "seu_token")

# Produtos
produtos = client.products.list()
produto = client.products.get(123)
client.products.create({"name": "Produto X"})

# Pedidos
pedidos = client.orders.list()

# Clientes
cliente = client.customers.get(456)

🧠 Organização do Código

src/nuvemshop_client/
├── client.py       # Classe principal que gerencia a autenticação e rotas
├── exception.py    # Erros customizados para tratar falhas de API
├── resources/
│   ├── base.py         # Classe base para todos os recursos
│   ├── products.py     # Métodos da API relacionados a produtos
│   ├── orders.py       # Métodos da API relacionados a pedidos
│   └── customers.py    # Métodos da API relacionados a clientes

📚 Recursos suportados

Produtos (client.products)

  • .list(page=1, limit=50)
  • .get(product_id)
  • .create(data)
  • .update(product_id, data)
  • .delete(product_id)

Pedidos (client.orders)

  • .list(page=1, limit=50)
  • .get(order_id)

Clientes (client.customers)

  • .list(page=1, limit=50)
  • .get(customer_id)

❗ Tratamento de erros

O client pode lançar essas exceções:

  • NuvemshopClientError: erro genérico da API
  • NuvemshopClientAuthenticationError: token inválido ou expirado
  • NuvemshopClientNotFoundError: recurso não encontrado

Use try/except para capturar e tratar esses erros.


💡 Como criar novos recursos

Basta herdar de BaseResource e usar self.client.get/post/put/delete(...).
Exemplo:

from .base import BaseResource

class MyResource(BaseResource):
    def list(self):
        return self.client.get("my-resource")

📜 Licença

MIT - Livre para usar, copiar, clonar, melhorar, quebrar e reconstruir.

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

nuvemshop_client_python-0.1.0.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

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

nuvemshop_client_python-0.1.0-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nuvemshop_client_python-0.1.0.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for nuvemshop_client_python-0.1.0.tar.gz
Algorithm Hash digest
SHA256 aca3ca8dc9643115d8030bf66b68836679416289a4d3c105ce543da92aa239c3
MD5 9764d93d8a7242fab8d6e83628f2aeb5
BLAKE2b-256 ed433f578b60a7a03420649c5df7a66a09c6e5d4451f1af1c847c48c46d566e6

See more details on using hashes here.

File details

Details for the file nuvemshop_client_python-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for nuvemshop_client_python-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3385d5714e8df26a6025146ab374170946c7b18c43737f4d1cab251cae711545
MD5 4ab08bda1817c035963d8bf2aa08fb9a
BLAKE2b-256 d9f32dde81e46324038e53f954c42239f1984222a2dc977bb99e2b95d69991de

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