Merge pull request #11 from srlabs/verifyimei_len

Added IMEI character length validation check
This commit is contained in:
muelli 2023-10-16 09:51:31 +02:00 committed by GitHub
commit 406360fad2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -141,6 +141,10 @@ def generate_imei(imei_prefix, imsi_d):
def validate_imei(imei):
# before anything check if length is 14 characters
if len(imei) != 14:
print(f"NOT A VALID IMEI: {imei} - IMEI must be 14 characters in length")
return False
# cut off last digit
validation_digit = int(imei[-1])
imei_verify = imei[0:14]