Skip to main content

python-codicefiscale is a tiny library for encode/decode Italian fiscal code - codifica/decodifica del Codice Fiscale.

Project description

Build Status codecov Code Health PyPI version Py versions License

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


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.1.tar.gz (90.5 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page