Skip to main content

Python VIN decoder

Project description

PyVIN

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 (https://vpic.nhtsa.dot.gov/api/)

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.

Source Distribution

pyvin-0.0.2.tar.gz (6.6 kB view hashes)

Uploaded Source

Built Distribution

pyvin-0.0.2-py3-none-any.whl (8.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page