Skip to main content

vin-parser

Library that provides functions to work with VIN strings.

Install

vin-parser is available on PyPI and can be installed using pip.

$ pip install vin-parser

Usage

All the public functions are exported to the package namespace. We'll alias it as vp in the following examples.

>>> import vin_parser as vp

The functions check_no, seq_no, wmi, vds and vis return parts of the VIN string.

>>> vin = "1GYFK63878R248711"
>>> vp.check_no(vin)
'7'

Function check_no returns the VIN check digit, i.e. position 9 in the VIN string. It returns for all VINs, even for those that don't use the check digit schema.

>>> vp.wmi(vin)
'1GY'
>>> vp.vds(vin)
'FK6387'

Lowercase VINs are accepted:

>>> vp.vis(vin.lower())
'8R248711'

check_valid, is_valid and small_manuf are predicate functions, i.e. functions that return True or False. check_valid returns True if the VIN's check digit matches the computed value. is_valid returns True if the provided VIN is valid. Because the use of VIN check digit is not adopted worldwide, the check_valid test is not performed when verifing the validity of a VIN.

Functions continent, country, year and manuf parse the VIN and return the values. year returns a positive integer, while the others return a string with their name.

>>> vp.country(vin)
'United States'
>>> vp.year(vin)
2008
>>> vp.manuf(vin)
'General Motors USA'

Function parse calls all the other functions and returns the results in a dict if the provided VIN is valid. Function online_parse queries the nhtsa api with the provided VIN. Empty values are removed from the response and the rest are returned in a python dict. No other transformations are performed on the keys or values. Note that, unlike parse, online_parse doesn't check if the VIN is valid before sending it to the remote server.

The CHARS constant is a sorted string with all the valid characters of a VIN: A to Z, 1 to 9 and 0, except for I, O and Q.

Metadata

Release files for vin-parser 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vin-parser 0.0.1
File Size Uploaded
vin-parser-0.0.1.tar.gz 11.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for vin-parser 0.0.1
File Interpreter ABI Platform
vin_parser-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 22.4 kB

Release files / vin-parser-0.0.1.tar.gz

Download URL vin-parser-0.0.1.tar.gz
Size 11.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a6a2f783d1db8328abc22e71c75462f74a86c30fb0df41478ce5bb79149c1938
BLAKE2b-256 checksum
How to use checksums
79ac10f1ecddcff819f8f2d8260d4b18243aa09eb30e2f3e63a474ae894ba85d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.1 CPython/3.7.5

Release files / vin_parser-0.0.1-py3-none-any.whl

Download URL vin_parser-0.0.1-py3-none-any.whl
Size 11.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ce45ce0de447e5a1edb3400766dfde0816513ddca08e48c41b305e2669cc88d1
BLAKE2b-256 checksum
How to use checksums
e540b15e3efe13279a6cc4607ed31f7564e7b094313f464769a2619c18aa80e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.1 CPython/3.7.5

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page