Skip to main content

Mint NOIDs using a CLI or API

Project description

noid Python Package

PyPI version PyPI - Python Version example workflow codecov

Installation

Install from PyPI with

pip install noid

or from source with

pip install git+git@github.com:paulkorir/noid.git     # SSH
pip install git+https://github.com/paulkorir/noid.git # HTTPS

CLI Usage

Generating a noid

Use the noid command with no arguments:

noid

There are various options available using -h/--help:

noid -h
usage: noid [-h] [-c CONFIG_FILE] [-v] [-s SCHEME] [-N NAA] [-t TEMPLATE] [-n INDEX] [--verbose] [noid]

generate nice and opaque identifiers (noids)

positional arguments:
  noid                  a noid

optional arguments:
  -h, --help            show this help message and exit
  -c CONFIG_FILE, --config-file CONFIG_FILE
                        path to a config file with a noid section
  -v, --validate        validate the given noid [default: False]
  -s SCHEME, --scheme SCHEME
                        the noid scheme [default: 'ark:/']
  -N NAA, --naa NAA     the name assigning authority (NAA) number [default: ]
  -t TEMPLATE, --template TEMPLATE
                        the template by which to generate noids [default: 'zeeddk']
  -n INDEX, --index INDEX
                        a number for which to generate a valid noid [default: random positive integer]
  --verbose             turn on verbose text [default: False]

Validating a noid

Validate a noid using the -v/--validate flag and pass a noid.

noid -v $(noid) # self-validation

Options

Specify the NAA

Use the -N/--naa option.

noid --naa 1234

Specify the scheme

Use the -s/--scheme option.

noid --scheme darpa::

Specify a template

Use the -t/--template option.

noid -t zeeddeedeedk

Compute a noid for a value

API Usage

You can also use this package's API in your code.

import random

from noid import mint, validate, calculate_check_digit, generate_noid

# with default arguments
noid = mint()

# arguments: template, n, scheme, naa
noid = mint(template='zeedeeedk', n=37, scheme='https://', naa='802938')

# validating a noid
validate(noid) # True/False

# calculate the check digit
calculate_check_digit(noid)

# low-level generate a noid from a mask and number; no check digit is appended
noid = generate_noid('eeddeed', random.randint(100, 1000))

Testing

pip install -r requirements.txt
tox

Authors

See also the list of contributors who participated in this project.

Thanks

This tool was heavily influenced from noid-mint

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

noid-1.0.0a2.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

noid-1.0.0a2-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file noid-1.0.0a2.tar.gz.

File metadata

  • Download URL: noid-1.0.0a2.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.0

File hashes

Hashes for noid-1.0.0a2.tar.gz
Algorithm Hash digest
SHA256 8f6dbc289a389b84e3068395f054677994508d60fbdb825d4628f4b5f7e280e4
MD5 2510a6756f78dc1c3b75c8f785db4ce0
BLAKE2b-256 7bc62ec63b47f9065be289a3ffe9b514c47c1c183111cb34c0b7d361393e0406

See more details on using hashes here.

File details

Details for the file noid-1.0.0a2-py3-none-any.whl.

File metadata

  • Download URL: noid-1.0.0a2-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.0

File hashes

Hashes for noid-1.0.0a2-py3-none-any.whl
Algorithm Hash digest
SHA256 1115e5afac0a6918c58486add3c00d182c7bed820af71d40e09f2c513c1167c5
MD5 d0c6ff2b67e3b61cc8d2a3ad8689144a
BLAKE2b-256 26ee0d5d8fd62f2db89f3c0ee1c8355a094e7c6639075ad0f9411826074a2ebd

See more details on using hashes here.

Supported by

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