Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

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
Release History

Release History

This version
History Node

0.1.3

History Node

0.1.1

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
kennitala-0.1.3.tar.gz (3.9 kB) Copy SHA256 Checksum SHA256 Source Nov 12, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting