Skip to main content

Python SDK for the Credere credit simulation API

Project description

credere-sdk

Python SDK for the Credere credit simulation API.

Installation

pip install credere-sdk

Usage

Sync client

from credere import CredereClient

client = CredereClient(api_key="your-api-key", store_id=1)

# Leads
from credere import LeadCreateRequest

lead = client.leads.create(LeadCreateRequest(cpf_cnpj="12345678900", name="João Silva"))
lead = client.leads.get("12345678900")
leads = client.leads.list()
lead = client.leads.update("12345678900", LeadCreateRequest(name="João Atualizado"))
client.leads.delete("12345678900")
fields = client.leads.required_fields("12345678900")

# Simulations
from credere import SimulationCreateRequest, SimulationConditionRequest, SimulationVehicleRequest

sim = client.simulations.create(SimulationCreateRequest(
    assets_value=5000000,
    conditions=[SimulationConditionRequest(down_payment=1000000, financed_amount=4000000, installments=48)],
    retrieve_lead={"cpf_cnpj": "12345678900"},
    seller_cpf="98765432100",
    vehicle=SimulationVehicleRequest(
        asset_value=5000000,
        licensing_uf="SP",
        manufacture_year=2024,
        model_year=2024,
        vehicle_molicar_code="MOL123",
        zero_km=True,
    ),
))
sim = client.simulations.get("simulation-uuid")
sims = client.simulations.list()

# Proposals
from credere import ProposalCreateRequest

proposal = client.proposals.create(ProposalCreateRequest(simulation_id="sim-uuid"))
proposal = client.proposals.get("proposal-uuid")
proposals = client.proposals.list()
activity = client.proposals.activity_log("proposal-uuid")

# Customers
from credere import CustomerCreateRequest

customer = client.customers.create(CustomerCreateRequest(cpf_cnpj="12345678900", name="João Silva"))
customer = client.customers.get(1)
customers = client.customers.list()
customer = client.customers.find(cpf_cnpj="12345678900")

# Stores
from credere import StoreCreateRequest

store = client.stores.create(StoreCreateRequest(name="Loja Centro", display_name="Centro", cnpj="12345678000100"))
stores = client.stores.list()
store = client.stores.activate(1)
store = client.stores.deactivate(1)

# Vehicle Models
models = client.vehicle_models.list()
model = client.vehicle_models.search(q="Civic")
prices = client.vehicle_models.prices()

# Stock
from credere import StockVehicleCreateRequest

vehicle = client.stock.create(StockVehicleCreateRequest(vehicle_model_id=1, store_id=1))
vehicles = client.stock.list()
vehicle = client.stock.update(1, StockVehicleCreateRequest(price_cents=5000000))
vehicle = client.stock.remove(1)

# Users
user = client.users.current()
users = client.users.proposals_filter_list()

# Utilities
domains = client.utilities.domains()
lead_domains = client.utilities.lead_domains()
banks = client.utilities.banks()
vehicle = client.utilities.vehicle_by_plate("ABC1D23")
vehicle = client.utilities.vehicle_by_chassis("9BWZZZ377VT004251")

# Bank Credentials
integrated_banks = client.bank_credentials.list(store_id=1)
client.bank_credentials.persist(store_id=1)

# Proposal Attempts
from credere import ProposalAttemptCreateRequest

attempt = client.proposal_attempts.create("proposal-uuid", ProposalAttemptCreateRequest())
attempts = client.proposal_attempts.list("proposal-uuid")
attempt = client.proposal_attempts.get("proposal-uuid", "attempt-uuid")
attempt = client.proposal_attempts.perform_action("proposal-uuid", "attempt-uuid", "approve")

# Plus Returns
from credere import PlusReturnRuleCreateRequest

rule = client.plus_returns.create(PlusReturnRuleCreateRequest())
rules = client.plus_returns.list()
rule = client.plus_returns.get(1)
rule = client.plus_returns.activate(1)
rule = client.plus_returns.deactivate(1)
client.plus_returns.delete(1)

client.close()

Async client

from credere import AsyncCredereClient

async with AsyncCredereClient(api_key="your-api-key", store_id=1) as client:
    leads = await client.leads.list()
    sims = await client.simulations.list()
    proposals = await client.proposals.list()
    customers = await client.customers.list()
    stores = await client.stores.list()
    models = await client.vehicle_models.list()
    vehicles = await client.stock.list()
    user = await client.users.current()
    domains = await client.utilities.domains()
    banks = await client.bank_credentials.list(store_id=1)
    attempts = await client.proposal_attempts.list("proposal-uuid")
    rules = await client.plus_returns.list()

Features

  • Leads — create, update, delete, list, get, and required_fields
  • Simulations — create, list, and get
  • Proposals — create, list, get, update, delete, ownership, and activity log
  • Customers — create, update, list, get, and find
  • Stores — create, list, activate, and deactivate
  • Users — current user and proposals filter list
  • Vehicle Models — list, search, and prices
  • Stock — create, list, update, and remove
  • Utilities — domains, lead domains, banks, vehicle by plate/chassis
  • Bank Credentials — persist and list integrated banks
  • Proposal Attempts — create, list, get, update, and perform action
  • Plus Returns — create, list, get, update, delete, activate, and deactivate
  • Sync and async clients (built on httpx)
  • Pydantic models for request/response validation
  • Error mapping (401, 404, timeouts, connection errors)
  • Per-request store_id override

License

Apache 2.0

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

credere_sdk-0.2.0.tar.gz (64.0 kB view details)

Uploaded Source

Built Distribution

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

credere_sdk-0.2.0-py3-none-any.whl (28.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for credere_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e6d35bc3756f94c31327a1db5162f46be0d623a9795a8a220d1f4edb246d5a38
MD5 105cacdb09388817c5c9cc6f1ff2b747
BLAKE2b-256 acad1e03a39e0c5bba3858b42a203e960eeb560ff48db3a137a6732a9f2fc05d

See more details on using hashes here.

Provenance

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

Publisher: publish.yml on MotocredOficial/credere_sdk

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

File details

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

File metadata

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

File hashes

Hashes for credere_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4cf05827b54c20fed0921234ea63bbda4755208446116ce9132d10e8175175e2
MD5 350d3b7b52caf6d40f71f6fb322d29d5
BLAKE2b-256 9ade0ae339ead48f3ec7bcdf23e88abaf03f81ec65dc7b4a3a3385fd2b5d3814

See more details on using hashes here.

Provenance

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

Publisher: publish.yml on MotocredOficial/credere_sdk

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