python-codicefiscale is a tiny library for encode/decode Italian fiscal code - 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.2.0.tar.gz
(90.7 kB
view hashes)
Close
Hashes for python-codicefiscale-0.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b53d4da161eb67fc8154e6f86a8701b3ecf0e723822d880c5e42223e43609e9 |
|
MD5 | 74f03952d83992f9a6e20b3ae5234c0a |
|
BLAKE2b-256 | 81c2c6032bde3b321528331783b0a7ab922909954e5746385af3cc7391f27276 |