Files
appointment_tool/utils/generate_random_passport_id.py
T
2022-06-08 21:39:45 +02:00

42 lines
1.3 KiB
Python

import random
import string
from pojo.captcha_error_contact_pojo import ContactInErrorPojo
from pojo.contact_pojo import ContactPojo
letters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'P', 'Q', 'R', 'S', 'T', '1', '2', '3', '4', '5', '6', '7',
'8', '9']
def get_random_id_number() -> str:
S = 8 # number of characters in the string.
ran = ''.join(random.choices(string.digits, k=S))
id_number = str(ran)
return id_number
def get_random_passport_id_number() -> str:
S = 7 # number of characters in the string.
ran = ''.join(random.choices(string.digits, k=S))
id_number = "E" + random.choice(letters) + str(ran)
return id_number
def get_captcha_error_contact_from_contact(contact: ContactPojo, error_type: int) -> ContactInErrorPojo:
captcha_error = ContactInErrorPojo()
captcha_error.mail = contact.mail
captcha_error.ccid = contact.ccid
captcha_error.phone = contact.phone
captcha_error.passport = contact.passport
captcha_error.first_name = contact.first_name
captcha_error.last_name = contact.last_name
captcha_error.position = contact.position
captcha_error.error_type = error_type
return captcha_error
if __name__ == '__main__':
# for i in range(1,200):
# print(get_random_id_number())
for i in range(1, 804):
print(get_random_id_number())