Greek TIN/AFM Validator and Generator
Validate and generate Greek TIN (Tax Identification Number) / AFM (Αριθμός Φορολογικού Μητρώου). Generation function can create valid or invalid numbers including parameters for old format, individuals, legal entities and repet tolerance digits control.
Online demo and presentation
https://lytrax.io/blog/projects/greek-tin-validator-generator
Installation
pip install lytrax-afm
Usage
Import functions:
from lytrax_afm import validateAFM, \
generateAFM, \
generateValidAFM, \
generateInvalidAFM
Validate a number:
>>> validate_afm("090000045")
True
>>> validate_afm("123456789")
False
Generate a valid number:
>>> generate_valid_afm()
'731385437'
Generate an invalid number:
>>> generate_invalid_afm()
'853003357'
API
validate_afm
afm: str- A string to be check if it's a valid AFMextended_result: bool, optional- Return extended object result if True, single boolean otherwise (default is False)- Returns:
strordict(Dictionary with'valid': booleanand'error': str ('length' or 'nan' or 'zero' or 'invalid'))
Example:
>>> validate_afm("ab1234", extended_result=True)
{'valid': False, 'error': 'length'}
generate_afm
force_first_digit: int, optional- If specified, overrides all pre99, legalEntity and individual (default is None)pre99: bool, optional- Για ΑΦΜ πριν από 1/1/1999 (ξεκινάει με 0), (if True, overrides both legal_entity and individual) (default is False)individual: bool, optional- Φυσικά πρόσωπα, (ξεκινάει με 1-4) (default is False)legal_entity: bool, optional- Νομικές οντότητες (ξεκινάει με 7-9) (default is False)repeat_tolerance : int, optional- Number for max repeat tolerance (0 for no repeats, unspecified for no check) (default is None)valid: bool, optional- Generate valid or invalid AFM (default is True)- Returns:
str- A valid or invalid 9 digit AFM number
Example:
>>> generate_afm(force_first_digit=3, repeat_tolerance=1, valid=True)
'335151580'
generate_valid_afm - Same as generate_afm with valid parameter force and override to True
- Returns:
str- A valid 9 digit AFM number
Example:
>>> generate_valid_afm(pre99=True)
'013583460'
generate_invalid_afm - Same as generate_afm with valid parameter force and override to False
- Returns:
str- An invalid 9 digit AFM number
Example:
>>> generate_invalid_afm(legal_entity=True)
'780300643'
Test
Clone this repository, run test:
git clone https://github.com/clytras/afm-python.git && cd afm-python
python -m unittest discover -s './test' -v
Changelog
See CHANGELOG
License
MIT License - see the LICENSE file for details
Metadata
Release files for lytrax-afm 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| lytrax_afm-1.0.1.tar.gz | 4.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lytrax_afm-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.8 kB
Release files / lytrax_afm-1.0.1.tar.gz
| Download URL | lytrax_afm-1.0.1.tar.gz |
|---|---|
| Size | 4.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
221239e6cf4809a4304e2da0726069fbc42dd6dea170e9c1b61c37c061f6d7e4
|
|
BLAKE2b-256 checksum How to use checksums |
ed8a0c9c7b285ea324656e3dd756c0600fc75c00bb54f9fb3aa5ee0c1bbd8a79
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.8.1
|
Release files / lytrax_afm-1.0.1-py3-none-any.whl
| Download URL | lytrax_afm-1.0.1-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
875d022edaacf2ade094837bc69321621a4b8cd4af5abf02ede940f4e49807e1
|
|
BLAKE2b-256 checksum How to use checksums |
78a6c70cf81eabf61328df00b2fbb76e17863a653c6634d8f60c6d6181e5532b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.8.1
|
Security for lytrax-afm 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.