python-codicefiscale
python-codicefiscale is a tiny library for encode/decode Italian fiscal code - codifica/decodifica del Codice Fiscale.
Features
- Transliteration for name/surname
- Multiple birthdate formats (datetime/string) (you can see all the supported string formats in
tests/tests.py) - Automatic birthplace city/foreign-country code detection from name
- Omocodia support
Installation
pip install python-codicefiscale
Usage
Import
from codicefiscale import codicefiscale
Encode
codicefiscale.encode(surname='Caccamo', name='Fabio', sex='M', birthdate='03/04/1985', birthplace='Torino')
# 'CCCFBA85D03L219P'
Decode
codicefiscale.decode('CCCFBA85D03L219P')
# {
# 'code': 'CCCFBA85D03L219P',
# 'sex': 'M',
# 'birthdate': datetime.datetime(1985, 4, 3, 0, 0),
# 'birthplace': {
# 'name': 'TORINO'
# 'province': 'TO',
# 'code': 'L219',
# },
# 'omocodes': [
# 'CCCFBA85D03L219P',
# 'CCCFBA85D03L21VE',
# 'CCCFBA85D03L2MVP',
# 'CCCFBA85D03LNMVE',
# 'CCCFBA85D0PLNMVA',
# 'CCCFBA85DLPLNMVL',
# 'CCCFBA8RDLPLNMVX',
# 'CCCFBAURDLPLNMVU',
# ],
# 'raw': {
# 'code': 'CCCFBA85D03L219P',
# 'surname': 'CCC',
# 'name': 'FBA',
# 'birthdate': '85D03',
# 'birthdate_year': '85'
# 'birthdate_month': 'D',
# 'birthdate_day': '03',
# 'birthplace': 'L219',
# 'cin': 'P',
# },
# }
Check
codicefiscale.is_valid('CCCFBA85D03L219P')
# True
codicefiscale.is_omocode('CCCFBA85D03L219P')
# False
Test
tox / python setup.py test / python -m unittest tests.tests
License
Released under MIT License.
Metadata
Release files for python-codicefiscale 0.3.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| python-codicefiscale-0.3.5.tar.gz | 90.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| python_codicefiscale-0.3.5-py2-none-any.whl | Python 2 | none | any | Details |
Total release size: 185.6 kB
Release files / python-codicefiscale-0.3.5.tar.gz
| Download URL | python-codicefiscale-0.3.5.tar.gz |
|---|---|
| Size | 90.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
803ba96066fc07a0cf934cbc7e7bde19c2cc1c78a40e806e08786e408b514730
|
|
BLAKE2b-256 checksum How to use checksums |
3ac3abd0f5df86d511a9bb51bd7f4e099449620e1b017cf6bf58014380412ebc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.3
|
Release files / python_codicefiscale-0.3.5-py2-none-any.whl
| Download URL | python_codicefiscale-0.3.5-py2-none-any.whl |
|---|---|
| Size | 94.8 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
1327dfa239cf236cd2abdbde5173b80b3bb8407a0283df2e43950f9cb206a5f5
|
|
BLAKE2b-256 checksum How to use checksums |
e140c7cfae32e5cb925b98c42c7aaf61778de7d57966051874413fa3d23f1c67
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.3
|