stdnum.tr.tckimlik

T.C. Kimlik No. (Turkish personal identification number)

The Turkish Identification Number (Türkiye Cumhuriyeti Kimlik Numarası) is a unique personal identification number assigned to every citizen of Turkey. The number consists of 11 digits and the last two digits are check digits.

More information:

>>> validate('17291716060')
'17291716060'
>>> validate('17291716050')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> validate('1729171606')
Traceback (most recent call last):
    ...
InvalidLength: ...
>>> validate('07291716092')  # number must not start with a 0
Traceback (most recent call last):
    ...
InvalidFormat: ...
stdnum.tr.tckimlik.calc_check_digits(number)

Calculate the check digits for the specified number. The number passed should not have the check digit included.

stdnum.tr.tckimlik.check_kps(number, name, surname, birth_year, timeout)

Query the online T.C. Kimlik validation service run by the Directorate of Population and Citizenship Affairs. The timeout is in seconds. This returns a boolean but may raise a SOAP exception for missing or invalid values.

stdnum.tr.tckimlik.compact(number)

Convert the number to the minimal representation. This strips the number of any valid separators and removes surrounding whitespace.

stdnum.tr.tckimlik.is_valid(number)

Check if the number is a valid T.C. Kimlik number.

stdnum.tr.tckimlik.tckimlik_wsdl = 'https://tckimlik.nvi.gov.tr/Service/KPSPublic.asmx?WSDL'

The WSDL URL of the T.C. Kimlik validation service.

stdnum.tr.tckimlik.validate(number)

Check if the number is a valid T.C. Kimlik number. This checks the length and check digits.