cardog 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. cardog-0.1.0/.gitignore +86 -0
  2. cardog-0.1.0/PKG-INFO +154 -0
  3. cardog-0.1.0/README.md +122 -0
  4. cardog-0.1.0/pyproject.toml +66 -0
  5. cardog-0.1.0/src/cardog/__init__.py +57 -0
  6. cardog-0.1.0/src/cardog/_async_client.py +85 -0
  7. cardog-0.1.0/src/cardog/_base_client.py +257 -0
  8. cardog-0.1.0/src/cardog/_client.py +82 -0
  9. cardog-0.1.0/src/cardog/_constants.py +3 -0
  10. cardog-0.1.0/src/cardog/_exceptions.py +69 -0
  11. cardog-0.1.0/src/cardog/py.typed +0 -0
  12. cardog-0.1.0/src/cardog/resources/__init__.py +39 -0
  13. cardog-0.1.0/src/cardog/resources/charging.py +115 -0
  14. cardog-0.1.0/src/cardog/resources/complaints.py +116 -0
  15. cardog-0.1.0/src/cardog/resources/efficiency.py +143 -0
  16. cardog-0.1.0/src/cardog/resources/fuel.py +94 -0
  17. cardog-0.1.0/src/cardog/resources/history.py +45 -0
  18. cardog-0.1.0/src/cardog/resources/listings.py +287 -0
  19. cardog-0.1.0/src/cardog/resources/locations.py +123 -0
  20. cardog-0.1.0/src/cardog/resources/market.py +340 -0
  21. cardog-0.1.0/src/cardog/resources/recalls.py +121 -0
  22. cardog-0.1.0/src/cardog/resources/research.py +178 -0
  23. cardog-0.1.0/src/cardog/resources/safety.py +122 -0
  24. cardog-0.1.0/src/cardog/resources/vin.py +104 -0
  25. cardog-0.1.0/src/cardog/types/__init__.py +13 -0
  26. cardog-0.1.0/src/cardog/types/charging.py +86 -0
  27. cardog-0.1.0/src/cardog/types/common.py +121 -0
  28. cardog-0.1.0/src/cardog/types/complaints.py +41 -0
  29. cardog-0.1.0/src/cardog/types/efficiency.py +53 -0
  30. cardog-0.1.0/src/cardog/types/fuel.py +100 -0
  31. cardog-0.1.0/src/cardog/types/history.py +18 -0
  32. cardog-0.1.0/src/cardog/types/listings.py +122 -0
  33. cardog-0.1.0/src/cardog/types/locations.py +55 -0
  34. cardog-0.1.0/src/cardog/types/market.py +293 -0
  35. cardog-0.1.0/src/cardog/types/recalls.py +98 -0
  36. cardog-0.1.0/src/cardog/types/research.py +54 -0
  37. cardog-0.1.0/src/cardog/types/safety.py +62 -0
  38. cardog-0.1.0/src/cardog/types/vin.py +140 -0
  39. cardog-0.1.0/tests/__init__.py +0 -0
  40. cardog-0.1.0/tests/conftest.py +61 -0
  41. cardog-0.1.0/tests/test_client.py +101 -0
  42. cardog-0.1.0/tests/test_contracts_async.py +53 -0
  43. cardog-0.1.0/tests/test_contracts_charging.py +56 -0
  44. cardog-0.1.0/tests/test_contracts_complaints.py +35 -0
  45. cardog-0.1.0/tests/test_contracts_efficiency.py +32 -0
  46. cardog-0.1.0/tests/test_contracts_fuel.py +54 -0
  47. cardog-0.1.0/tests/test_contracts_listings.py +122 -0
  48. cardog-0.1.0/tests/test_contracts_locations.py +55 -0
  49. cardog-0.1.0/tests/test_contracts_market.py +145 -0
  50. cardog-0.1.0/tests/test_contracts_recalls.py +52 -0
  51. cardog-0.1.0/tests/test_contracts_research.py +36 -0
  52. cardog-0.1.0/tests/test_contracts_safety.py +32 -0
  53. cardog-0.1.0/tests/test_contracts_vin.py +49 -0
@@ -0,0 +1,86 @@
1
+ # env files in any directory
2
+ .env*
3
+ .env.local
4
+ .env.example
5
+ .env.development.local
6
+ .env.test.local
7
+ .env.production.local
8
+
9
+ # Override global gitignore - allow TypeScript env modules
10
+ !src/env/
11
+ !apps/*/src/env/
12
+
13
+ # Override global gitignore - allow parts directories in services
14
+ !src/services/parts/
15
+ !apps/*/src/services/parts/
16
+
17
+ packages/assets
18
+
19
+ # wrangler
20
+ .wrangler
21
+
22
+ candog
23
+ tab
24
+
25
+ # misc
26
+ .DS_Store
27
+ *.pem
28
+ *.db
29
+ *.db.br
30
+ *.db.gz
31
+
32
+ # Playwright
33
+ playwright-report
34
+
35
+ # Test results
36
+ test-results
37
+
38
+ # python
39
+ __pycache__
40
+ .venv
41
+
42
+ # next
43
+ next-env.d.ts
44
+
45
+ # node_modules
46
+ node_modules
47
+
48
+ # dist
49
+ dist/
50
+
51
+ # test.3d.vin
52
+ test.3d.vin
53
+
54
+ # Ignore packages/vPIC-download for now
55
+ packages/vpic-pipeline
56
+
57
+ # Submodules
58
+ @cardog-icons/
59
+
60
+
61
+ # foxfuck folder
62
+ foxfuck
63
+
64
+ # vehicle-media folder
65
+ vehicle-media
66
+
67
+ # brochure folder
68
+ brochure
69
+
70
+ # turbo
71
+ .turbo
72
+
73
+ # vercel
74
+ .vercel
75
+
76
+ # cursor
77
+ .cursor
78
+
79
+ # sandbox directory
80
+ sandbox
81
+
82
+ # Any claude folders
83
+ .claude
84
+
85
+
86
+ docs
cardog-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,154 @@
1
+ Metadata-Version: 2.4
2
+ Name: cardog
3
+ Version: 0.1.0
4
+ Summary: Official Python SDK for the Cardog API
5
+ Project-URL: Homepage, https://cardog.app
6
+ Project-URL: Documentation, https://docs.cardog.app
7
+ Project-URL: Repository, https://github.com/cardog-ai/cardog-python
8
+ Author-email: Cardog <hello@cardog.app>
9
+ License-Expression: MIT
10
+ Keywords: api,automotive,cardog,sdk,vehicle,vin
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Classifier: Typing :: Typed
22
+ Requires-Python: >=3.9
23
+ Requires-Dist: httpx>=0.25.0
24
+ Requires-Dist: pydantic>=2.0.0
25
+ Provides-Extra: dev
26
+ Requires-Dist: mypy>=1.10; extra == 'dev'
27
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
28
+ Requires-Dist: pytest-httpx>=0.30; extra == 'dev'
29
+ Requires-Dist: pytest>=8.0; extra == 'dev'
30
+ Requires-Dist: ruff>=0.4; extra == 'dev'
31
+ Description-Content-Type: text/markdown
32
+
33
+ # Cardog Python SDK
34
+
35
+ Official Python SDK for the [Cardog API](https://docs.cardog.app) — automotive intelligence, VIN decoding, market analytics, and more.
36
+
37
+ ## Installation
38
+
39
+ ```bash
40
+ pip install cardog
41
+ ```
42
+
43
+ ## Quick Start
44
+
45
+ ```python
46
+ from cardog import Cardog
47
+
48
+ client = Cardog(api_key="your-api-key")
49
+
50
+ # Decode a VIN
51
+ vehicle = client.vin.decode("1HGCM82633A123456")
52
+ print(vehicle.components.vehicle.make) # "Honda"
53
+
54
+ # Search listings
55
+ results = client.listings.search(
56
+ makes=["Toyota"],
57
+ year_min=2020,
58
+ price_max=30000,
59
+ )
60
+ for listing in results.listings:
61
+ print(f"{listing.year} {listing.make} {listing.model} - ${listing.price}")
62
+
63
+ # Market overview
64
+ overview = client.market.overview("Honda", "Civic", 2022)
65
+ print(f"Median price: ${overview.median_price}")
66
+
67
+ # Recalls
68
+ recalls = client.recalls.search("us", makes=["Tesla"])
69
+ print(f"Found {recalls.meta.count} recalls")
70
+
71
+ # EV charging stations
72
+ stations = client.charging.search(lat=43.65, lng=-79.38, radius=10)
73
+ for station in stations.stations:
74
+ print(f"{station.name} - {station.network}")
75
+
76
+ # Fuel prices
77
+ fuel = client.fuel.get("regular", lat=43.65, lng=-79.38)
78
+ print(f"Current price: {fuel.current} {fuel.unit}")
79
+ ```
80
+
81
+ ## Async Support
82
+
83
+ ```python
84
+ import asyncio
85
+ from cardog import AsyncCardog
86
+
87
+ async def main():
88
+ client = AsyncCardog(api_key="your-api-key")
89
+
90
+ vehicle = await client.vin.decode("1HGCM82633A123456")
91
+ listings = await client.listings.search(makes=["Toyota"])
92
+
93
+ await client.close()
94
+
95
+ asyncio.run(main())
96
+ ```
97
+
98
+ ## Available Resources
99
+
100
+ | Resource | Description |
101
+ |----------|-------------|
102
+ | `client.vin` | VIN decoding (single, batch, image) |
103
+ | `client.listings` | Vehicle listing search, count, facets |
104
+ | `client.market` | Market analytics, pricing, trends, geography |
105
+ | `client.recalls` | US & Canadian vehicle recalls |
106
+ | `client.charging` | EV charging station search |
107
+ | `client.fuel` | Fuel prices and gas station search |
108
+ | `client.research` | Vehicle variants, specs, images |
109
+ | `client.locations` | Dealer/seller search |
110
+ | `client.safety` | NHTSA safety ratings |
111
+ | `client.efficiency` | EPA fuel economy data |
112
+ | `client.complaints` | NHTSA complaints |
113
+ | `client.history` | Vehicle history reports |
114
+
115
+ ## Configuration
116
+
117
+ ```python
118
+ client = Cardog(
119
+ api_key="your-api-key",
120
+ base_url="https://api.cardog.io/v1", # default
121
+ timeout=30.0, # seconds
122
+ max_retries=2, # retry on 429/5xx
123
+ )
124
+ ```
125
+
126
+ ## Error Handling
127
+
128
+ ```python
129
+ from cardog import Cardog, NotFoundError, RateLimitError, AuthenticationError
130
+
131
+ client = Cardog(api_key="your-api-key")
132
+
133
+ try:
134
+ vehicle = client.vin.decode("INVALID")
135
+ except NotFoundError:
136
+ print("VIN not found")
137
+ except RateLimitError as e:
138
+ print(f"Rate limited, retry after {e.retry_after}s")
139
+ except AuthenticationError:
140
+ print("Invalid API key")
141
+ ```
142
+
143
+ ## Type Safety
144
+
145
+ All responses are Pydantic models with full type hints. Your IDE will provide autocomplete for every field.
146
+
147
+ ```python
148
+ result = client.market.overview("Toyota", "Camry", 2023)
149
+ # IDE knows result.avg_price is float, result.total_listings is int, etc.
150
+ ```
151
+
152
+ ## License
153
+
154
+ MIT
cardog-0.1.0/README.md ADDED
@@ -0,0 +1,122 @@
1
+ # Cardog Python SDK
2
+
3
+ Official Python SDK for the [Cardog API](https://docs.cardog.app) — automotive intelligence, VIN decoding, market analytics, and more.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install cardog
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```python
14
+ from cardog import Cardog
15
+
16
+ client = Cardog(api_key="your-api-key")
17
+
18
+ # Decode a VIN
19
+ vehicle = client.vin.decode("1HGCM82633A123456")
20
+ print(vehicle.components.vehicle.make) # "Honda"
21
+
22
+ # Search listings
23
+ results = client.listings.search(
24
+ makes=["Toyota"],
25
+ year_min=2020,
26
+ price_max=30000,
27
+ )
28
+ for listing in results.listings:
29
+ print(f"{listing.year} {listing.make} {listing.model} - ${listing.price}")
30
+
31
+ # Market overview
32
+ overview = client.market.overview("Honda", "Civic", 2022)
33
+ print(f"Median price: ${overview.median_price}")
34
+
35
+ # Recalls
36
+ recalls = client.recalls.search("us", makes=["Tesla"])
37
+ print(f"Found {recalls.meta.count} recalls")
38
+
39
+ # EV charging stations
40
+ stations = client.charging.search(lat=43.65, lng=-79.38, radius=10)
41
+ for station in stations.stations:
42
+ print(f"{station.name} - {station.network}")
43
+
44
+ # Fuel prices
45
+ fuel = client.fuel.get("regular", lat=43.65, lng=-79.38)
46
+ print(f"Current price: {fuel.current} {fuel.unit}")
47
+ ```
48
+
49
+ ## Async Support
50
+
51
+ ```python
52
+ import asyncio
53
+ from cardog import AsyncCardog
54
+
55
+ async def main():
56
+ client = AsyncCardog(api_key="your-api-key")
57
+
58
+ vehicle = await client.vin.decode("1HGCM82633A123456")
59
+ listings = await client.listings.search(makes=["Toyota"])
60
+
61
+ await client.close()
62
+
63
+ asyncio.run(main())
64
+ ```
65
+
66
+ ## Available Resources
67
+
68
+ | Resource | Description |
69
+ |----------|-------------|
70
+ | `client.vin` | VIN decoding (single, batch, image) |
71
+ | `client.listings` | Vehicle listing search, count, facets |
72
+ | `client.market` | Market analytics, pricing, trends, geography |
73
+ | `client.recalls` | US & Canadian vehicle recalls |
74
+ | `client.charging` | EV charging station search |
75
+ | `client.fuel` | Fuel prices and gas station search |
76
+ | `client.research` | Vehicle variants, specs, images |
77
+ | `client.locations` | Dealer/seller search |
78
+ | `client.safety` | NHTSA safety ratings |
79
+ | `client.efficiency` | EPA fuel economy data |
80
+ | `client.complaints` | NHTSA complaints |
81
+ | `client.history` | Vehicle history reports |
82
+
83
+ ## Configuration
84
+
85
+ ```python
86
+ client = Cardog(
87
+ api_key="your-api-key",
88
+ base_url="https://api.cardog.io/v1", # default
89
+ timeout=30.0, # seconds
90
+ max_retries=2, # retry on 429/5xx
91
+ )
92
+ ```
93
+
94
+ ## Error Handling
95
+
96
+ ```python
97
+ from cardog import Cardog, NotFoundError, RateLimitError, AuthenticationError
98
+
99
+ client = Cardog(api_key="your-api-key")
100
+
101
+ try:
102
+ vehicle = client.vin.decode("INVALID")
103
+ except NotFoundError:
104
+ print("VIN not found")
105
+ except RateLimitError as e:
106
+ print(f"Rate limited, retry after {e.retry_after}s")
107
+ except AuthenticationError:
108
+ print("Invalid API key")
109
+ ```
110
+
111
+ ## Type Safety
112
+
113
+ All responses are Pydantic models with full type hints. Your IDE will provide autocomplete for every field.
114
+
115
+ ```python
116
+ result = client.market.overview("Toyota", "Camry", 2023)
117
+ # IDE knows result.avg_price is float, result.total_listings is int, etc.
118
+ ```
119
+
120
+ ## License
121
+
122
+ MIT
@@ -0,0 +1,66 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "cardog"
7
+ version = "0.1.0"
8
+ description = "Official Python SDK for the Cardog API"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ requires-python = ">=3.9"
12
+ authors = [{ name = "Cardog", email = "hello@cardog.app" }]
13
+ keywords = ["cardog", "automotive", "vin", "vehicle", "api", "sdk"]
14
+ classifiers = [
15
+ "Development Status :: 4 - Beta",
16
+ "Intended Audience :: Developers",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python :: 3.9",
20
+ "Programming Language :: Python :: 3.10",
21
+ "Programming Language :: Python :: 3.11",
22
+ "Programming Language :: Python :: 3.12",
23
+ "Programming Language :: Python :: 3.13",
24
+ "Typing :: Typed",
25
+ "Topic :: Software Development :: Libraries :: Python Modules",
26
+ ]
27
+ dependencies = [
28
+ "httpx>=0.25.0",
29
+ "pydantic>=2.0.0",
30
+ ]
31
+
32
+ [project.urls]
33
+ Homepage = "https://cardog.app"
34
+ Documentation = "https://docs.cardog.app"
35
+ Repository = "https://github.com/cardog-ai/cardog-python"
36
+
37
+ [project.optional-dependencies]
38
+ dev = [
39
+ "pytest>=8.0",
40
+ "pytest-asyncio>=0.23",
41
+ "pytest-httpx>=0.30",
42
+ "ruff>=0.4",
43
+ "mypy>=1.10",
44
+ ]
45
+
46
+ [tool.hatch.build.targets.wheel]
47
+ packages = ["src/cardog"]
48
+
49
+ [tool.ruff]
50
+ target-version = "py39"
51
+ line-length = 100
52
+
53
+ [tool.ruff.lint]
54
+ select = ["E", "F", "I", "UP"]
55
+
56
+ [tool.mypy]
57
+ python_version = "3.9"
58
+ strict = true
59
+ plugins = ["pydantic.mypy"]
60
+
61
+ [tool.pytest.ini_options]
62
+ testpaths = ["tests"]
63
+ asyncio_mode = "auto"
64
+ markers = [
65
+ "contract: marks tests that hit the live API (requires CARDOG_API_KEY)",
66
+ ]
@@ -0,0 +1,57 @@
1
+ """Cardog - Official Python SDK for the Cardog API.
2
+
3
+ Usage::
4
+
5
+ from cardog import Cardog
6
+
7
+ client = Cardog(api_key="your-api-key")
8
+
9
+ # Decode a VIN
10
+ vehicle = client.vin.decode("1HGCM82633A123456")
11
+
12
+ # Search listings
13
+ results = client.listings.search(makes=["Toyota"], year_min=2020, price_max=30000)
14
+
15
+ # Market analysis
16
+ overview = client.market.overview("Honda", "Civic", 2022)
17
+
18
+ For async usage::
19
+
20
+ from cardog import AsyncCardog
21
+
22
+ client = AsyncCardog(api_key="your-api-key")
23
+ vehicle = await client.vin.decode("1HGCM82633A123456")
24
+ """
25
+
26
+ from cardog._async_client import AsyncCardog
27
+ from cardog._client import Cardog
28
+ from cardog._constants import DEFAULT_BASE_URL
29
+ from cardog._exceptions import (
30
+ APIError,
31
+ AuthenticationError,
32
+ CardogError,
33
+ ConnectionError,
34
+ NotFoundError,
35
+ PermissionError,
36
+ RateLimitError,
37
+ ServerError,
38
+ TimeoutError,
39
+ )
40
+
41
+ __version__ = "0.1.0"
42
+
43
+ __all__ = [
44
+ "Cardog",
45
+ "AsyncCardog",
46
+ "DEFAULT_BASE_URL",
47
+ # Exceptions
48
+ "CardogError",
49
+ "APIError",
50
+ "AuthenticationError",
51
+ "PermissionError",
52
+ "NotFoundError",
53
+ "RateLimitError",
54
+ "ServerError",
55
+ "ConnectionError",
56
+ "TimeoutError",
57
+ ]
@@ -0,0 +1,85 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import Optional
4
+
5
+ from cardog._base_client import AsyncAPIClient
6
+ from cardog._constants import DEFAULT_BASE_URL, DEFAULT_MAX_RETRIES, DEFAULT_TIMEOUT
7
+ from cardog.resources import (
8
+ AsyncChargingResource,
9
+ AsyncComplaintsResource,
10
+ AsyncEfficiencyResource,
11
+ AsyncFuelResource,
12
+ AsyncHistoryResource,
13
+ AsyncListingsResource,
14
+ AsyncLocationsResource,
15
+ AsyncMarketResource,
16
+ AsyncRecallsResource,
17
+ AsyncResearchResource,
18
+ AsyncSafetyResource,
19
+ AsyncVinResource,
20
+ )
21
+
22
+
23
+ class AsyncCardog(AsyncAPIClient):
24
+ """Asynchronous Cardog API client.
25
+
26
+ Usage::
27
+
28
+ import asyncio
29
+ from cardog import AsyncCardog
30
+
31
+ async def main():
32
+ client = AsyncCardog(api_key="your-api-key")
33
+
34
+ # Decode a VIN
35
+ vehicle = await client.vin.decode("1HGCM82633A123456")
36
+
37
+ # Search listings
38
+ listings = await client.listings.search(makes=["Toyota"], year_min=2020)
39
+
40
+ await client.close()
41
+
42
+ asyncio.run(main())
43
+
44
+ Args:
45
+ api_key: Your Cardog API key.
46
+ base_url: API base URL (default: https://api.cardog.io/v1).
47
+ timeout: Request timeout in seconds (default: 30).
48
+ max_retries: Max retry attempts for failed requests (default: 2).
49
+ """
50
+
51
+ vin: AsyncVinResource
52
+ listings: AsyncListingsResource
53
+ market: AsyncMarketResource
54
+ recalls: AsyncRecallsResource
55
+ charging: AsyncChargingResource
56
+ fuel: AsyncFuelResource
57
+ research: AsyncResearchResource
58
+ locations: AsyncLocationsResource
59
+ safety: AsyncSafetyResource
60
+ efficiency: AsyncEfficiencyResource
61
+ complaints: AsyncComplaintsResource
62
+ history: AsyncHistoryResource
63
+
64
+ def __init__(
65
+ self,
66
+ api_key: str,
67
+ *,
68
+ base_url: str = DEFAULT_BASE_URL,
69
+ timeout: float = DEFAULT_TIMEOUT,
70
+ max_retries: int = DEFAULT_MAX_RETRIES,
71
+ ) -> None:
72
+ super().__init__(api_key, base_url=base_url, timeout=timeout, max_retries=max_retries)
73
+
74
+ self.vin = AsyncVinResource(self)
75
+ self.listings = AsyncListingsResource(self)
76
+ self.market = AsyncMarketResource(self)
77
+ self.recalls = AsyncRecallsResource(self)
78
+ self.charging = AsyncChargingResource(self)
79
+ self.fuel = AsyncFuelResource(self)
80
+ self.research = AsyncResearchResource(self)
81
+ self.locations = AsyncLocationsResource(self)
82
+ self.safety = AsyncSafetyResource(self)
83
+ self.efficiency = AsyncEfficiencyResource(self)
84
+ self.complaints = AsyncComplaintsResource(self)
85
+ self.history = AsyncHistoryResource(self)