python-codicefiscale is a tiny library for encode/decode Italian fiscal codes - codifica/decodifica del Codice Fiscale.
Project description
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/country code detection
Omocodia support
Installation
pip install python-codicefiscale
Usage
Encoding
from codicefiscale import codicefiscale
codicefiscale.encode(surname='Caccamo', name='Fabio', sex='M', birthdate='03/04/1985', birthplace='Torino')
# returns 'CCCFBA85D03L219P'
Decoding
from codicefiscale import codicefiscale
codicefiscale.decode('CCCFBA85D03L219P')
# returns a dict contaning: 'code', 'sex' ('M' or 'F'), 'birthdate' (datetime), 'birthplace' (dict), 'cin'
Checking
from codicefiscale import codicefiscale
codicefiscale.is_valid('CCCFBA85D03L219P')
# returns True
Testing
python -m unittest tests.tests
# or
python setup.py test
# or
tox
License
Released under MIT License.
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
python-codicefiscale-0.1.0.tar.gz
(90.3 kB
view hashes)
Close
Hashes for python-codicefiscale-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87df8e22fe021423972757d2e78e2fceebd58a9cf55b1f86427d0bcc11ff872d |
|
MD5 | 4a82f77ca654fc7e8ec3b6464069324f |
|
BLAKE2b-256 | fad6b1153d7e4a22d729739e0fffb2e361d83ce275e5294c37d11ebf1da8e60f |