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
Release history Release notifications | RSS feed
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 details)
Built Distribution
pyvin-0.0.2-py3-none-any.whl
(8.9 kB
view details)
File details
Details for the file pyvin-0.0.2.tar.gz
.
File metadata
- Download URL: pyvin-0.0.2.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.6.6rc1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 482ed532acaac1fbc5344663251e9387a3633809be5ec930e1f66654ce79854a |
|
MD5 | 5933ff4edecadd8efcef3b4bcff0ef6a |
|
BLAKE2b-256 | 7022f5639497ebf948c93ce2f75209cfbe8eb0d18cb7ee26f29e2788eff594e9 |
File details
Details for the file pyvin-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: pyvin-0.0.2-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.6.6rc1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f51b23ea11c8f669d992c39430299e2ecca0f8a5c4dd85ca6b9abf1f0c93e3b |
|
MD5 | 7a257005af093bf414044cfc7f6395f2 |
|
BLAKE2b-256 | 1602aada2872a4a041dbff5ba2d7040c13d2641ea404a534c4703a6bc2bd2ee3 |