idlesign / vininfo Goto Github PK
View Code? Open in Web Editor NEWExtracts useful information from Vehicle Identification Number (VIN)
Home Page: https://github.com/idlesign/vininfo
License: BSD 3-Clause "New" or "Revised" License
Extracts useful information from Vehicle Identification Number (VIN)
Home Page: https://github.com/idlesign/vininfo
License: BSD 3-Clause "New" or "Revised" License
Numbers from official Russian CTC
WBA71DC010CH14720 -> Reported as incorrect
https://vpic.nhtsa.dot.gov/decoder/CheckDigit/Index/5yj3e1eaxhf000316 -> Reports incorrect 10th digit (zero)
https://www.cjponyparts.com/resources/check-digit-calculator -> Returns correct.
I have read the comment, that not all follow control digit logic, but looks like on some online resources VIN is validated correctly.
ver. 1.6.0
W1V44770513858498
Manufacturer: Mercedes-Benz
Model: 911
Hi, i'm getting this error on some vin's
In [1]: import vininfo
In [2]: vininfo.Vin("2LNBL8EV9AX604020")
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-2-267facbdc2ff> in <module>
----> 1 vininfo.Vin("2LNBL8EV9AX604020")
/usr/lib/python3.6/site-packages/vininfo/toolbox.py in __init__(self, num)
28 self.num = self.validate(num)
29
---> 30 details_extractor = self.brand.extractor
31
32 if details_extractor:
AttributeError: 'NoneType' object has no attribute 'extractor'
... Some more failing ...
2LMHJ5NK8EBL51686
5J8YD4H5XKL000637
19XFC2F74GE219952
2LNBL8CV9AX610404
58ABK1GG9HU067426
3CZRM3H59CG705077
2LNHM82V09X602289
2LMHJ5NKXEBL54766
2HNYD2H34CH544142
2C4RDGCG3HR589219
2HNYD2H69BH528012
2HNYD28218H504518
2HNYD28378H536818
19XFC1F76GE220868
2LNBL8CV1BX754840
2C4RDGCG6DR590925
2C4RDGCG3HR857170
2C4RDGBG1CR392642
2A4RR5D13AR299997
2LMHJ5NK4EBL51281
2HNYD2H36CH513331
2LMHJ5AR1ABJ50404
2LNBL8EV4BX754439
2LMDJ8JK9FBL32362
Does this part of the quick guide supposed to return something?
details = vin.details
verify_checksum states that do not use year by default, but it does.
There is a problem when I check valid VIN I receive "Checksum is not valid"
vininfo, is version 1.7.0
For example:
vininfo check NMTDM26R30R030595
Checksum is not valid
Checking same VIN online shows all is fine and all car details.
I checked it in www.autodna.com and www.vindecoder.pl
NM35600006T458287
Fiat EGEA
At the end of each year new models appear with next year as a model year which is not supported
It seems irrational to be, but to make validate (classmethod) work, you have to instantiate the Vin with a VIN number and call validate again with a VIN number.
Vin('someVIN').validate('someVIN')
is the only way that I managed to make it work.
In my humble opinion, you should be able to check like so:
vin = 'SomeVIN'
vin_object = Vin(vin)
vin_object.validate() # This returns True or False
P.S.1:
Or even better would be:
vin = 'SomeVIN'
vin_object = Vin(vin)
if vin_object.is_valid: # This returns True or False
print('Yay!')
vin_object.is_valid_with_exception() # or something like that
>>> InvalidVIN: This VIN number is invalid.
P.S.2:
I had an idea:
def validate(self, num: str = None, with_exception: bool = False) -> str:
"""Performs basic VIN validation and sanation.
:param num: Other VIN to check
:param with_exception: Flag to determine if the validate function should raise an exception or not.
"""
if num is None:
num = self.num
num = num.strip().upper()
if len(num) != 17:
raise ValidationError(f'VIN number requires 17 chars ({num_len} given)')
pattern = r"^[A-HJ-NPR-Z0-9]{17}$"
if not re.match(pattern, num):
if with_exception:
raise ValidationError(f"VIN number must only contain alphanumeric symbols except 'I', 'O', and 'Q' ")
else:
return False
return True
Cheers ๐บ
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.