Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kennitala-0.1.3.tar.gz (3.9 kB view details)

Uploaded Source

File details

Details for the file kennitala-0.1.3.tar.gz.

File metadata

  • Download URL: kennitala-0.1.3.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for kennitala-0.1.3.tar.gz
Algorithm Hash digest
SHA256 271591f5a4f7dfbc813843e6680295fd7147c4d7f6caa65fa47bbd90c0db91e4
MD5 4fb1abe59f9ff4245dc4760ecd9d2e8d
BLAKE2b-256 cc1dbec8d12c5e8dab98da8468dd49558a63aafac55ef9b7c4bf3e078d17ade4

See more details on using hashes here.

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