No project description provided
Project description
iyg_tools
iyg_tools
is a Python package for validating and generating Turkish Citizen Numbers (TCKN). The TCKN is a unique identification number used in Turkey, consisting of 11 digits. This package provides two main features:
- Validate TCKN: Check if a given TCKN is valid based on the Turkish government algorithm.
- Generate TCKN: Produce a random but valid TCKN.
Installation
You can install iyg_tools
from PyPI using pip:
pip install iyg_tools
Usage
Once installed, you can use iyg_tools
to validate and generate TCKNs.
Validate TCKN
To validate a TCKN, use the verify
function. It takes a TCKN as input and returns a dictionary indicating whether the TCKN is valid.
Example:
from tckn_app import verify
result = verify('12345678901')
print(result)
Output:
{'status': True, 'message': "'12345678901' verified!"}
If the TCKN is invalid, the dictionary will contain an error message:
{'status': False, 'error': "'12345678901' not verified!"}
Generate TCKN
To generate a valid TCKN, use the generate
function. It returns a valid TCKN as an integer.
Example:
from tckn_app import generate
tckn = generate()
print(tckn)
Output:
12345678901
Functions
verify(tckn)
Validates the provided TCKN.
Parameters:
tckn
(str or int): The TCKN to validate.
Returns:
dict
: A dictionary with the validation status and message. If valid,status
isTrue
with a success message. If invalid,status
isFalse
with an error message.
generate()
Generates a valid TCKN.
Returns:
int
: A valid TCKN.
Example
Here's a complete example demonstrating both functionalities:
from tckn_app import verify, generate
# Generate a valid TCKN
valid_tckn = generate()
print(f"Generated TCKN: {valid_tckn}")
# Validate the generated TCKN
validation_result = verify(valid_tckn)
print(validation_result)
License
This package is licensed under the MIT License. See the LICENSE file for details.
Contributing
Contributions are welcome! If you find a bug or have suggestions for improvements, please submit a pull request or open an issue.
Author
This package is maintained by Your Name.
Project Links
- GitHub Repository: https://github.com/yourusername/iyg_tools
- PyPI Page: https://pypi.org/project/iyg_tools/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file iyg_tools-1.0.3.tar.gz
.
File metadata
- Download URL: iyg_tools-1.0.3.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e222103a4dcf2c3648c2fff990a6fbab68c9aa404a6c2dbbfd05de417e1b29b |
|
MD5 | f96e65d320215d24f42988b6f1e3f277 |
|
BLAKE2b-256 | 03814197f0ba1fda5783d2581ce5cf57979b20370a56855cafa595995acebc7e |
File details
Details for the file iyg_tools-1.0.3-py3-none-any.whl
.
File metadata
- Download URL: iyg_tools-1.0.3-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24cd5c30e6572f09b8606e9aeb0030890fb3421490621464baca22ad9032df3a |
|
MD5 | 08b9311404088d3add61c0ad0e692c5c |
|
BLAKE2b-256 | e202c7290cd32b18c4e06a696086f3a3bad0549f05ed1a19fbe1a1c200894d7a |