Skip to main content

Python VIN decoder

Project description


A Vehicle Identification Number (VIN) decoder for Python. This leverages the NHTSA API to decode VINs into collections of vehicle data that can be easily explored (

Basic Usage:

In [0]: from pyvin import VIN

In [1]: vehicle = VIN('JT2AE09W4P0038539')

In [2]: (vehicle.Make, vehicle.Model, vehicle.ModelYear)
Out[2]: ('TOYOTA', 'Corolla', '1993')

In [3]: my_vins = ('JT2AE09W4P0038539', 'KMHD35LH5EU205042')

In [4]: my_vehicles = VIN(*my_vins)

In [5]: for veh in my_vehicles:
   ...:     print(veh.Make, veh.Model, veh.ModelYear)
TOYOTA Corolla 1993
HYUNDAI Elantra 2014

Advanced Usage:

The user can also specify how invalid VINs are handled, be it raising an exception or ignoring them:

In [6]: import pyvin
In [7]: new_car = pyvin.VIN('Foo', error_handling=pyvin.RAISE)
Out[7]: VINError: Invalid char "o"the u

To simply clean a VIN list, with no decoding involved, the following can be called:

In [8]: import pyvin

In [9]: my_vins = ('JT2AE09W4P0038539', 'Foo')

In [10]: cleaned_vins = pyvin.clean_vins(my_vins)

In [11]: cleaned_vins
Out[11]: ['JT2AE09W4P0038539']

For simple validation, no calls to the NHTSA API are used, as there is a formula to validate VINs

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pyvin, version 0.0.2
Filename, size File type Python version Upload date Hashes
Filename, size pyvin-0.0.2-py3-none-any.whl (8.9 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size pyvin-0.0.2.tar.gz (6.6 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page