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.1.1.tar.gz (23.5 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.1.1-py3-none-any.whl (29.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: credere_sdk-0.1.1.tar.gz
  • Upload date:
  • Size: 23.5 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.1.1.tar.gz
Algorithm Hash digest
SHA256 6213c227d4e82b53a29073860252797a126d2a138c61cc60294e67d4b243994c
MD5 84b14064d954fa24ee36f65a92523d74
BLAKE2b-256 eec2a52d7e3dbd49fdb379e34cce1951d00cff160e1ca598ea4efce9299dee63

See more details on using hashes here.

Provenance

The following attestation bundles were made for credere_sdk-0.1.1.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.1.1-py3-none-any.whl.

File metadata

  • Download URL: credere_sdk-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 29.1 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.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0f1ecd0fcae20e9a24c24f0c4929045cfa184c774cc70cfea5e19038a6930130
MD5 e10a5271a0d5b23e0b9baa539eb8d569
BLAKE2b-256 842c3675890535a73bf6278590ff0b09cbedd6c022dfe22c4ba47f3be67cd7bf

See more details on using hashes here.

Provenance

The following attestation bundles were made for credere_sdk-0.1.1-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