DVLA Vehicle Enquiry Service Python SDK
dvla_vehicle_enquiry_service is a Python SDK providing a simple interface for interacting with the DVLA (Driver and Vehicle Licensing Agency) Vehicle Enquiry Service API. It allows retrieval of detailed vehicle information based on the registration number, including tax status, MOT status, and more.
Installation
Install the package using pip:
pip install dvla_vehicle_enquiry_service
Usage
Initialisation
To use the VehicleEnquiryAPI class, you'll need an API key provided by the DVLA service. You can also specify the environment as either production or test (default is production).
from dvla_vehicle_enquiry_service import VehicleEnquiryAPI
api_key = "your_api_key"
# Initialise client using the default ('production') API
client = VehicleEnquiryAPI(api_key)
# Or initialise client using the test API
client = VehicleEnquiryAPI(api_key, environment="test")
Fetch Vehicle Details by Registration
To fetch vehicle details using its registration number:
import asyncio
from dvla_vehicle_enquiry_service import VehicleResponse, VehicleEnquiryError
async def get_vehicle_details():
response = await api.get_vehicle("AA19MOT")
mot_status = response.motStatus.value if response.motStatus else "Unknown"
print(f"Vehicle Make: {response.make}, MOT Status: {mot_status}")
asyncio.run(get_vehicle_details())
If the request is successful, this example will print something such as: Vehicle Make: AUDI, MOT Status: Valid.
Error Handling
Errors are raised as VehicleEnquiryError exceptions. You can catch and handle these exceptions to access detailed error information.
try:
response = await client.get_vehicle("ER19NFD")
except VehicleEnquiryError as e:
print(f"Error {e.status}: {e.title} - {e.detail}")
Classes and Data Structures
Vehicle Class
VehicleResponse: Represents detailed information about a vehicle, including tax status, MOT status, make, model, and various other attributes.
Error Handling Classes
VehicleEnquiryError: Exception class that encapsulates error information, including status codes and error details.
Enum Classes
TaxStatus: Enumerates possible tax statuses of a vehicle (TAXED,UNTAXED,SORN, etc.).MotStatus: Enumerates possible MOT statuses of a vehicle (VALID,NOT_VALID,NO_DETAILS_HELD, etc.).
License
This project is licensed under the MIT License.
Contributing
Contributions are welcome! Please feel free to submit a pull request.
Metadata
Release files for dvla-vehicle-enquiry-service 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dvla_vehicle_enquiry_service-1.0.4.tar.gz | 5.8 kB | Without provenance | Details for dvla_vehicle_enquiry_service-1.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dvla_vehicle_enquiry_service-1.0.4-py3-none-any.whl | Python 3 | none | any | Details for dvla_vehicle_enquiry_service-1.0.4-py3-none-any.whl |
Total release size: 13.5 kB
Release files / dvla_vehicle_enquiry_service-1.0.4.tar.gz
| Download URL | dvla_vehicle_enquiry_service-1.0.4.tar.gz |
|---|---|
| Size | 5.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5013796a29cc66a0d6ca0a38dd3563d6d92f3f417310c3c074e044329fae6954
|
|
BLAKE2b-256 checksum How to use checksums |
dd9bd1c8cfe5d42f7f6b662638d83934d13451275fed324eea5013b81e6cfab2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.6
|
Release files / dvla_vehicle_enquiry_service-1.0.4-py3-none-any.whl
| Download URL | dvla_vehicle_enquiry_service-1.0.4-py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8343958ab688e17d7b433f3da2a25e24824afd204fb5b4d5d7476335d54c6029
|
|
BLAKE2b-256 checksum How to use checksums |
d4c69a35c4a7c60555eeb1b4f17cc75fc727e55c5b45d322949153669c21b84d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.6
|
Security for dvla-vehicle-enquiry-service 1.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.