Skip to main content

Norwegian numbers

PyPI Build Status Coverage Status License

Make and verify official Norwegian numbers:

  • KID-nummer: make_kid_number and verify_kid_number
  • Organisasjonsnummer: make_organisation_number and verify_organisation_number
  • Fødselsnummer: make_birth_number and verify_birth_number
  • Kontonummer: make_account_number and verify_account_number

This currently only concerns itself with the control digits.

Installation

To install from PyPi as a module in your environment:

pip install norwegian-numbers

To install from source as a module in your environment:

python setup.py install

Code usage from installation

Example code usages after installation:

>>> import norwegian_numbers as nn
>>> nn.make_kid_number('1234', 'mod10')
'12344'
>>> nn.verify_kid_number('12344', 'mod10')
True
>>> nn.make_account_number('1234567890')
'12345678903'
>>> nn.make_organisation_number('12345678')
'123456785'
>>> nn.make_birth_number('311299567')
'31129956715'

Running from command line

Usage from command line:

$ python -m norwegian_numbers --help
usage: __main__.py [-h]
                (-m {kid10,kid11,organisation,birth,account} | -v {kid10,kid11,organisation,birth,account})
                value

Generate or verify KID-nummer, organisasjonsnummer, fødselsnummer, kontonummer

positional arguments:
value                 The value to make or verify based on

optional arguments:
-h, --help            show this help message and exit
-m {kid10,kid11,organisation,birth,account}, --make {kid10,kid11,organisation,birth,account}
                        Choose what to make
-v {kid10,kid11,organisation,birth,account}, --verify {kid10,kid11,organisation,birth,account}
                        Choose what to verify

Example usage:

$ python -m norwegian_numbers -m kid10 1234
12344
$ python -m norwegian_numbers -v kid10 12344
True
$ python -m norwegian_numbers -m account 1234567890
12345678903
$ python -m norwegian_numbers -m organisation 12345678
123456785
$ python -m norwegian_numbers -m birth 311299567
31129956715

Testing from source

To run the tests:

python -m unittest discover

Or if you have tox:

tox

Or for coverage (with html report):

coverage run -m unittest discover
coverage html

Sources

Some sources on the background material:

Distribution

The distribution was created by the following commands:

python setup.py sdist bdist_wheel
python -m twine upload dist/*

Release files for norwegian-numbers 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for norwegian-numbers 1.0.2
File Size Uploaded
norwegian-numbers-1.0.2.tar.gz 5.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for norwegian-numbers 1.0.2
File Interpreter ABI Platform
norwegian_numbers-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 10.9 kB

Release files / norwegian-numbers-1.0.2.tar.gz

Download URL norwegian-numbers-1.0.2.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f928a68dbc96c5ab3d8ef6137f97322a03dceffa579a6467efdeb2fec966053d
BLAKE2b-256 checksum
How to use checksums
5c961ca91a00e587b066a2c8001a6a4659db8bc60608035e945355808e80890e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.0

Release files / norwegian_numbers-1.0.2-py3-none-any.whl

Download URL norwegian_numbers-1.0.2-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8ef95383810d2bf1ba4597e7cb61bc714d0877342187533ba4eca9f7ea337d7b
BLAKE2b-256 checksum
How to use checksums
b08392d5f068cda58746334ef7815f72ca2dd7f49cc4ceaae602d7b0cf8e41b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.0

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page