# 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:

- https://en.wikipedia.org/wiki/Turkish_Identification_Number

- https://tckimlik.nvi.gov.tr/

    >>> 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: str) → str

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

stdnum.tr.tckimlik.check_kps(number: str, name: str, surname: str, birth_year: int, timeout: float = 30, verify: bool | str = True) → bool

  Use the T.C. Kimlik validation service to check the provided number.

  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.

  The timeout argument specifies the network timeout in seconds.

  The verify argument is either a boolean that determines whether the server’s certificate is validate or a string which must be a path the CA certificate bundle to use for verification.

stdnum.tr.tckimlik.compact(number: str) → str

  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: str) → bool

  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: str) → str

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