getfreecarcheck 1.0.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.
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 GetFreeCarCheck
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
6
|
+
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
|
|
7
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
8
|
+
persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
|
|
11
|
+
Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
14
|
+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
15
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
16
|
+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: getfreecarcheck
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: UK car data API client: car reliability, MOT history and common faults, mileage, recalls, CO2, ULEZ and car tax from over 100 million DVSA MOT tests.
|
|
5
|
+
Project-URL: Homepage, https://getfreecarcheck.co.uk/developers
|
|
6
|
+
Project-URL: Documentation, https://getfreecarcheck.co.uk/developers/docs
|
|
7
|
+
Project-URL: Repository, https://github.com/getfreecarcheck/car-data-api
|
|
8
|
+
Author-email: GetFreeCarCheck <hello@getfreecarcheck.co.uk>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: car check,car reliability,car tax,dvsa,mot history,mot history api,number plate,recalls,registration lookup,uk car check,ulez,ved,vehicle data api
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
16
|
+
Requires-Python: >=3.9
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
|
|
19
|
+
# GetFreeCarCheck: UK car data API for Python
|
|
20
|
+
|
|
21
|
+
Car reliability, common MOT faults, mileage norms, safety recalls and CO2 for over 550 UK car models, from over
|
|
22
|
+
100 million DVSA MOT tests. Model data is free with no key. MOT history by number plate (every test, defects,
|
|
23
|
+
mileage record with rollback warnings, ULEZ, car tax and recalls) with a [free key](https://getfreecarcheck.co.uk/developers#key):
|
|
24
|
+
500 lookups a month, no card.
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
pip install getfreecarcheck
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
from getfreecarcheck import GetFreeCarCheck
|
|
32
|
+
|
|
33
|
+
gfc = GetFreeCarCheck()
|
|
34
|
+
r = gfc.reliability("Ford", "Fiesta")
|
|
35
|
+
print(f"{r['data']['name']}: {r['data']['failRate']}% first-time MOT fails")
|
|
36
|
+
print(r["meta"]["attribution"]) # credit line to show with the data
|
|
37
|
+
|
|
38
|
+
keyed = GetFreeCarCheck(key="gfc_live_...")
|
|
39
|
+
car = keyed.check("AB12 CDE") # vehicle, MOT history, mileage, ULEZ, tax, recalls
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Every answer carries `meta`: the sources, licence, a dated citation and the matching page on getfreecarcheck.co.uk.
|
|
43
|
+
Free plans show "Data: GetFreeCarCheck" with a link wherever the data appears.
|
|
44
|
+
|
|
45
|
+
- Docs and every field: https://getfreecarcheck.co.uk/developers/docs
|
|
46
|
+
- OpenAPI: https://api.getfreecarcheck.co.uk/v1/openapi.json
|
|
47
|
+
- AI assistants (MCP): https://api.getfreecarcheck.co.uk/mcp
|
|
48
|
+
- Plans: https://getfreecarcheck.co.uk/developers#plans
|
|
49
|
+
|
|
50
|
+
Contains public sector information licensed under the Open Government Licence v3.0, from the DVSA and the VCA.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# GetFreeCarCheck: UK car data API for Python
|
|
2
|
+
|
|
3
|
+
Car reliability, common MOT faults, mileage norms, safety recalls and CO2 for over 550 UK car models, from over
|
|
4
|
+
100 million DVSA MOT tests. Model data is free with no key. MOT history by number plate (every test, defects,
|
|
5
|
+
mileage record with rollback warnings, ULEZ, car tax and recalls) with a [free key](https://getfreecarcheck.co.uk/developers#key):
|
|
6
|
+
500 lookups a month, no card.
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
pip install getfreecarcheck
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```python
|
|
13
|
+
from getfreecarcheck import GetFreeCarCheck
|
|
14
|
+
|
|
15
|
+
gfc = GetFreeCarCheck()
|
|
16
|
+
r = gfc.reliability("Ford", "Fiesta")
|
|
17
|
+
print(f"{r['data']['name']}: {r['data']['failRate']}% first-time MOT fails")
|
|
18
|
+
print(r["meta"]["attribution"]) # credit line to show with the data
|
|
19
|
+
|
|
20
|
+
keyed = GetFreeCarCheck(key="gfc_live_...")
|
|
21
|
+
car = keyed.check("AB12 CDE") # vehicle, MOT history, mileage, ULEZ, tax, recalls
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Every answer carries `meta`: the sources, licence, a dated citation and the matching page on getfreecarcheck.co.uk.
|
|
25
|
+
Free plans show "Data: GetFreeCarCheck" with a link wherever the data appears.
|
|
26
|
+
|
|
27
|
+
- Docs and every field: https://getfreecarcheck.co.uk/developers/docs
|
|
28
|
+
- OpenAPI: https://api.getfreecarcheck.co.uk/v1/openapi.json
|
|
29
|
+
- AI assistants (MCP): https://api.getfreecarcheck.co.uk/mcp
|
|
30
|
+
- Plans: https://getfreecarcheck.co.uk/developers#plans
|
|
31
|
+
|
|
32
|
+
Contains public sector information licensed under the Open Government Licence v3.0, from the DVSA and the VCA.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "getfreecarcheck"
|
|
3
|
+
version = "1.0.0"
|
|
4
|
+
description = "UK car data API client: car reliability, MOT history and common faults, mileage, recalls, CO2, ULEZ and car tax from over 100 million DVSA MOT tests."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.9"
|
|
7
|
+
license = "MIT"
|
|
8
|
+
authors = [{ name = "GetFreeCarCheck", email = "hello@getfreecarcheck.co.uk" }]
|
|
9
|
+
keywords = ["car check", "uk car check", "mot history", "mot history api", "dvsa", "car reliability", "vehicle data api", "number plate", "registration lookup", "ulez", "car tax", "ved", "recalls"]
|
|
10
|
+
classifiers = ["Programming Language :: Python :: 3", "Operating System :: OS Independent", "Intended Audience :: Developers", "Topic :: Software Development :: Libraries"]
|
|
11
|
+
dependencies = []
|
|
12
|
+
|
|
13
|
+
[project.urls]
|
|
14
|
+
Homepage = "https://getfreecarcheck.co.uk/developers"
|
|
15
|
+
Documentation = "https://getfreecarcheck.co.uk/developers/docs"
|
|
16
|
+
Repository = "https://github.com/getfreecarcheck/car-data-api"
|
|
17
|
+
|
|
18
|
+
[build-system]
|
|
19
|
+
requires = ["hatchling"]
|
|
20
|
+
build-backend = "hatchling.build"
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"""GetFreeCarCheck API client: UK car reliability, MOT faults, mileage, recalls, CO2, ULEZ and car tax from over
|
|
2
|
+
100 million DVSA MOT tests. Docs: https://getfreecarcheck.co.uk/developers/docs"""
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
import json
|
|
7
|
+
import re
|
|
8
|
+
import urllib.error
|
|
9
|
+
import urllib.parse
|
|
10
|
+
import urllib.request
|
|
11
|
+
from typing import Any
|
|
12
|
+
|
|
13
|
+
__version__ = "1.0.0"
|
|
14
|
+
BASE = "https://api.getfreecarcheck.co.uk/v1"
|
|
15
|
+
__all__ = ["BASE", "GetFreeCarCheck", "ApiError"]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class ApiError(Exception):
|
|
19
|
+
def __init__(self, status: int, body: dict[str, Any]):
|
|
20
|
+
super().__init__(body.get("message") or body.get("error") or f"HTTP {status}")
|
|
21
|
+
self.status, self.body = status, body
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def _slug(s: str) -> str:
|
|
25
|
+
return re.sub(r"[^a-z0-9]+", "-", s.lower().strip()).strip("-")
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class GetFreeCarCheck:
|
|
29
|
+
"""key: only for number plate lookups (free at getfreecarcheck.co.uk/developers)."""
|
|
30
|
+
|
|
31
|
+
def __init__(self, key: str | None = None, base: str = BASE, timeout: float = 20):
|
|
32
|
+
self.key, self.base, self.timeout = key, base, timeout
|
|
33
|
+
|
|
34
|
+
def get(self, path: str, query: dict[str, Any] | None = None) -> dict[str, Any]:
|
|
35
|
+
q = "?" + urllib.parse.urlencode({k: v for k, v in query.items() if v is not None}) if query else ""
|
|
36
|
+
headers = {"user-agent": f"getfreecarcheck-python/{__version__}", "accept": "application/json"}
|
|
37
|
+
if self.key:
|
|
38
|
+
headers["x-api-key"] = self.key
|
|
39
|
+
req = urllib.request.Request(self.base + path + q, headers=headers)
|
|
40
|
+
try:
|
|
41
|
+
with urllib.request.urlopen(req, timeout=self.timeout) as r:
|
|
42
|
+
return json.load(r)
|
|
43
|
+
except urllib.error.HTTPError as e:
|
|
44
|
+
raise ApiError(e.code, json.loads(e.read() or b"{}")) from None
|
|
45
|
+
|
|
46
|
+
def _m(self, kind: str, make: str, model: str) -> dict[str, Any]:
|
|
47
|
+
return self.get(f"/{kind}/{_slug(make)}/{_slug(model)}")
|
|
48
|
+
|
|
49
|
+
def models(self) -> dict[str, Any]:
|
|
50
|
+
return self.get("/models")
|
|
51
|
+
|
|
52
|
+
def make(self, make: str) -> dict[str, Any]:
|
|
53
|
+
return self.get(f"/models/{_slug(make)}")
|
|
54
|
+
|
|
55
|
+
def model(self, make: str, model: str) -> dict[str, Any]:
|
|
56
|
+
return self._m("models", make, model)
|
|
57
|
+
|
|
58
|
+
def reliability(self, make: str, model: str) -> dict[str, Any]:
|
|
59
|
+
return self._m("reliability", make, model)
|
|
60
|
+
|
|
61
|
+
def defects(self, make: str, model: str) -> dict[str, Any]:
|
|
62
|
+
return self._m("defects", make, model)
|
|
63
|
+
|
|
64
|
+
def mileage(self, make: str, model: str) -> dict[str, Any]:
|
|
65
|
+
return self._m("mileage", make, model)
|
|
66
|
+
|
|
67
|
+
def recalls(self, make: str, model: str) -> dict[str, Any]:
|
|
68
|
+
return self._m("recalls", make, model)
|
|
69
|
+
|
|
70
|
+
def emissions(self, make: str, model: str) -> dict[str, Any]:
|
|
71
|
+
return self._m("emissions", make, model)
|
|
72
|
+
|
|
73
|
+
def rankings(self) -> dict[str, Any]:
|
|
74
|
+
return self.get("/rankings")
|
|
75
|
+
|
|
76
|
+
def national(self) -> dict[str, Any]:
|
|
77
|
+
return self.get("/national")
|
|
78
|
+
|
|
79
|
+
def vehicle(self, reg: str, part: str = "") -> dict[str, Any]:
|
|
80
|
+
"""Needs a key. part: "" (vehicle), "mot", "mileage" or "check" (everything)."""
|
|
81
|
+
r = urllib.parse.quote(re.sub(r"\s+", "", reg).upper())
|
|
82
|
+
return self.get(f"/vehicles/{r}" + (f"/{part}" if part else ""))
|
|
83
|
+
|
|
84
|
+
def check(self, reg: str) -> dict[str, Any]:
|
|
85
|
+
return self.vehicle(reg, "check")
|
|
86
|
+
|
|
87
|
+
def tax(self, first_registered: str, fuel: str, co2: int | None = None, engine_cc: int | None = None, list_price: int | None = None) -> dict[str, Any]:
|
|
88
|
+
return self.get("/tax/ved", {"firstRegistered": first_registered, "fuel": fuel, "co2": co2, "engineCc": engine_cc, "listPrice": list_price})
|
|
89
|
+
|
|
90
|
+
def zones(self, first_registered: str, fuel: str, kind: str | None = None) -> dict[str, Any]:
|
|
91
|
+
return self.get("/zones", {"firstRegistered": first_registered, "fuel": fuel, "kind": kind})
|
|
92
|
+
|
|
93
|
+
def usage(self) -> dict[str, Any]:
|
|
94
|
+
return self.get("/usage")
|