Skip to main content

Official Python SDK for the Cardog API

Project description

Cardog Python SDK

Official Python SDK for the Cardog API — automotive intelligence, VIN decoding, market analytics, and more.

Installation

pip install cardog

Quick Start

from cardog import Cardog

client = Cardog(api_key="your-api-key")

# Decode a VIN
vehicle = client.vin.decode("1HGCM82633A123456")
print(vehicle.components.vehicle.make)  # "Honda"

# Search listings
results = client.listings.search(
    makes=["Toyota"],
    year_min=2020,
    price_max=30000,
)
for listing in results.listings:
    print(f"{listing.year} {listing.make} {listing.model} - ${listing.price}")

# Market overview
overview = client.market.overview("Honda", "Civic", 2022)
print(f"Median price: ${overview.median_price}")

# Recalls
recalls = client.recalls.search("us", makes=["Tesla"])
print(f"Found {recalls.meta.count} recalls")

# EV charging stations
stations = client.charging.search(lat=43.65, lng=-79.38, radius=10)
for station in stations.stations:
    print(f"{station.name} - {station.network}")

# Fuel prices
fuel = client.fuel.get("regular", lat=43.65, lng=-79.38)
print(f"Current price: {fuel.current} {fuel.unit}")

Async Support

import asyncio
from cardog import AsyncCardog

async def main():
    client = AsyncCardog(api_key="your-api-key")

    vehicle = await client.vin.decode("1HGCM82633A123456")
    listings = await client.listings.search(makes=["Toyota"])

    await client.close()

asyncio.run(main())

Available Resources

Resource Description
client.vin VIN decoding (single, batch, image)
client.listings Vehicle listing search, count, facets
client.market Market analytics, pricing, trends, geography
client.recalls US & Canadian vehicle recalls
client.charging EV charging station search
client.fuel Fuel prices and gas station search
client.research Vehicle variants, specs, images
client.locations Dealer/seller search
client.safety NHTSA safety ratings
client.efficiency EPA fuel economy data
client.complaints NHTSA complaints
client.history Vehicle history reports

Configuration

client = Cardog(
    api_key="your-api-key",
    base_url="https://api.cardog.io/v1",  # default
    timeout=30.0,                          # seconds
    max_retries=2,                         # retry on 429/5xx
)

Error Handling

from cardog import Cardog, NotFoundError, RateLimitError, AuthenticationError

client = Cardog(api_key="your-api-key")

try:
    vehicle = client.vin.decode("INVALID")
except NotFoundError:
    print("VIN not found")
except RateLimitError as e:
    print(f"Rate limited, retry after {e.retry_after}s")
except AuthenticationError:
    print("Invalid API key")

Type Safety

All responses are Pydantic models with full type hints. Your IDE will provide autocomplete for every field.

result = client.market.overview("Toyota", "Camry", 2023)
# IDE knows result.avg_price is float, result.total_listings is int, etc.

License

MIT

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

cardog-0.1.0.tar.gz (24.1 kB view details)

Uploaded Source

Built Distribution

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

cardog-0.1.0-py3-none-any.whl (32.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for cardog-0.1.0.tar.gz
Algorithm Hash digest
SHA256 015abc125733d3c2ed81b5e507e44ec4ad14d4a7e901128c8bf4e48e20b976a6
MD5 97666d4aa2b6fd131d01147a277a82a3
BLAKE2b-256 c6a2faf1eb43a69c6155efd6ee608b49d5a8421016d2034e010ebdcbff05742a

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for cardog-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c20db35a1ea93675eb48500f73b1e65102cd4a05b69f9f485fe883234cd27386
MD5 83d867c742319916987a851bd307778e
BLAKE2b-256 10c06a1a32f8a6989fa27a648fac41cb9c37efd68e016e86ff26dc661f159623

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