Skip to main content

Cliente de autenticação Casasoft / CloudSlim

Project description

casasoft-auth

Cliente Python para autenticação e requisições autenticadas na API Casasoft / CloudSlim.

Este pacote abstrai: - Login - Gerenciamento de token JWT - Renovação automática em caso de expiração - Session HTTP com retry

Ideal para ETLs, integrações, scripts, APIs e automação.


📦 Instalação

Com pip:

pip install casasoft-auth

Ou com uv (recomendado):

uv pip install casasoft-auth

🚀 Uso básico

from casasoft_auth import create_session, TokenManager, CasasoftClient

LOGIN_URL = "https://auth.api.cloudslim.com.br/login"

session = create_session()

token_manager = TokenManager(
    session=session,
    login_url=LOGIN_URL,
    username="SEU_USUARIO",
    password="SUA_SENHA",
    empresa="CODIGO_EMPRESA"
)

client = CasasoftClient(session, token_manager)

response = client.request(
    "GET",
    "https://integracao.api.cloudslim.com.br/lancamentos",
    params={"periodo": "01/2026"}
)

print(response.json())

🔐 Boas práticas (importante)

Nunca versionar credenciais

Use variáveis de ambiente:

import os

token_manager = TokenManager(
    session=session,
    login_url=LOGIN_URL,
    username=os.getenv("CASASOFT_USER"),
    password=os.getenv("CASASOFT_PASS"),
    empresa=os.getenv("CASASOFT_EMPRESA"),
)

Exemplo .env:

CASASOFT_USER=api@empresa.com.br
CASASOFT_PASS=senha_super_secreta
CASASOFT_EMPRESA=CODIGO_EMPRESA

🧠 O que o pacote faz automaticamente

  • 🔁 Retry em erros 5xx
  • 🔄 Renovação automática do token em 401
  • 🧩 Reutilização de session HTTP
  • 🧼 Interface simples e limpa

📌 Requisitos

  • Python >= 3.9
  • requests >= 2.28

📄 Licença

MIT License


👤 Autor

Eduardo Henrique Pollheim

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

casasoft_auth-0.1.0.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

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

casasoft_auth-0.1.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: casasoft_auth-0.1.0.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for casasoft_auth-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e07b18a6524e88c78b9c726281f9d7f20cdb402ef8ff20d686ef1c0e523eada8
MD5 ad101e480b5f8e5de795290301fb019b
BLAKE2b-256 df6cadba11313d7f98f2c246660d1a3f53b9421ff08d2fc06b81ee709e50cab3

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for casasoft_auth-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 34d4b1a96afc91269baa3cbc7ce79ca223f1c1cef03e5a22e3e5eb77d8fc1545
MD5 e27322b477f84cb23fcb74030400797f
BLAKE2b-256 45efae3e95803911c245515c221da8aecdf0680d0bc7ff903f577dd2fb4d2480

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