Icelandic national registry codes made easy
Project description
python-kennitala is a python library for common operations on Icelandic National Registry codes - kennitala.
Capabilities
Validation of kennitala
Extraction of birth date from kennitala
Generating kennitala for a given birth date (for people or companies)
Generating random kennitala (for people or companies)
Recognize if kennitala belongs to person or company
Usage
>>> from datetime import date
>>> from kennitala import Kennitala
>>>
>>> kt_no = '0101109639'
>>> kennitala = Kennitala(kt_no)
>>> kennitala.validate()
True
>>> kennitala.get_birth_date()
datetime.date(1910, 1, 1)
>>> kennitala = Kennitala(kt_no.replace('3', '4'))
>>> kennitala.validate()
False
>>> kennitala.get_birht_date()
Traceback (most recent call last):
File kennitala.py, in get_birth_date
kennitala.Invalid
>>>
>>> company_kt = Kennitala.generate(date.today(), person=False)
>>> Kennitala.is_personal(company_kt)
False
Installation
inside your virtualenv execute:
$ pip install kennitala
or download and install manually.
Tests
Tests are written for py.test
To run tests simply execute:
$ PYTHONPATH=./ py.test tests
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kennitala-0.2.0.tar.gz.
File metadata
- Download URL: kennitala-0.2.0.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1288a2c3237e6156db66dc1483be1896a27b00b238d8de489f2bd03f3c57702b
|
|
| MD5 |
7f675107f9f21a0ec9578aafc1830eea
|
|
| BLAKE2b-256 |
2091541990531c7ab99411f989ec56d651bf37fc5e225ade5521fd5d7ae35b3d
|
File details
Details for the file kennitala-0.2.0-py3-none-any.whl.
File metadata
- Download URL: kennitala-0.2.0-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c5fba5ac4c1ab8b21af2aae9a229eefa1d149ea60fb0b3afcb6156e30d902ff3
|
|
| MD5 |
325f3667ce1e3eb57f53ad8f9c5ee0a8
|
|
| BLAKE2b-256 |
b8ca56cdec89322002265504e1ec8e6733478615c373e59725a0a6c822ec1a5b
|