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.3.0.tar.gz (91.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.3.0-py3-none-any.whl (28.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for credere_sdk-0.3.0.tar.gz
Algorithm Hash digest
SHA256 c6bc8739ad2cf9d81d3e5ecf4f04fda6fd48868b38aa9a5505ac8f9e71771a56
MD5 ddf1ae8cb08df7f52aee42ec309bd1c4
BLAKE2b-256 dbf27af79844dc71823601ccc3ed6f69cf40b8deebe953e9abbce4263cec4e4e

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: credere_sdk-0.3.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.12

File hashes

Hashes for credere_sdk-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7a5796b04577454b83ee7db79dd07107c3022acd367e981a808e302f64818c42
MD5 d721bf65d79281cdb369637013da1d92
BLAKE2b-256 8e4a25d241ea28fe8ecfa25ccc27b7d7c708fc440efd06f5990680f87d7b6a4d

See more details on using hashes here.

Provenance

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