How to use the vininfo.exceptions.ValidationError function in vininfo

To help you get started, we’ve selected a few vininfo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github idlesign / vininfo / vininfo / toolbox.py View on Github external
"""Performs basic VIN validation and sanation.

        :param num:

        """
        num = num.strip().upper()

        num_len = len(num)
        if num_len != 17:
            raise ValidationError(f'VIN number requires 17 chars ({num_len} given)')

        illegal = {'I', 'O', 'Q'}

        for ch in num:
            if ch in illegal:
                raise ValidationError(f"VIN number should not contain: {', '.join(illegal)}")

        return num