Skip to main content

Domain Name Label Indexes

https://img.shields.io/pypi/v/domain_name_label_indexes.svg https://img.shields.io/travis/ralexander-phi/domain_name_label_indexes.svg Documentation Status

This library helps generate minimal domain name labels in an ordered fashion. The following rules apply:

  • The label can contain only 0-9, a-z, and hyphen (-)

  • The label cannot begin or end with a hyphen

  • The label cannot contain two hyphens in a row

  • The label must be between 1 and 63 characters long

Note:

  • Unicode / Punycode are not considered (I.E., domains starting with xn– will not be generated).

  • Binary labels are not considered

Specifically, this library defines an ordering to domains such that they may be looked up by index. Domains are orders such that shorter domains occur earlier and domains of the same length occur in sorted order. The ordering begins as:

0 -> “0”

1 -> “1”

…

10 -> “a”

…

35 -> “z”

36 -> “00”

…

72 -> “10”

…

1331 -> “zz”

1332 -> “0-0”

  • Free software: MIT license

Features

Given an index, compute the corresposing domain name.

generate_domain_name_label(index: int)

For example:

generate_domain_name_label(0) => “0”

generate_domain_name_label(37) => “01”

Given an index, compute the length of the domain name.

compute_domain_length(index: int)

For example:

compute_domain_length(0) => 1

compute_domain_length(36) => 2

Find the first index that produces a domain of a given length.

first_index_with_domain_length(length: int)

For example:

first_index_with_domain_length(1) => 0

first_index_with_domain_length(2) => 36

Compute the number of domains that have a given length.

count_domains_with_length(length: int)

For example:

count_domains_with_length(1) => 36

count_domains_with_length(2) => 1296

Compute the index for a domain name label.

index_of_domain_name_label(label: str)

For example:

index_of_domain_name_label(“google”) => 1191294986

index_of_domain_name_label(“yahoo”) => 64297428

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

Metadata

Release files for domain-name-label-indexes 0.1.1

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

Source distribution (sdist)

Source distribution for domain-name-label-indexes 0.1.1
File Size Uploaded
domain_name_label_indexes-0.1.1.tar.gz 7.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for domain-name-label-indexes 0.1.1
File Interpreter ABI Platform
domain_name_label_indexes-0.1.1-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 12.2 kB

Release files / domain_name_label_indexes-0.1.1.tar.gz

Download URL domain_name_label_indexes-0.1.1.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
8497d191a93f0679107af4faa6308fd84cfdc7b5ecd3bef65963ae3b9f71ce6a
BLAKE2b-256 checksum
How to use checksums
230f405332a8431b80a172db1466cac65b173ea4eb421b07814bf9a1b4db0c21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.14.0 pkginfo/1.9.2 requests/2.28.1 setuptools/44.1.1 requests-toolbelt/0.10.1 tqdm/4.64.1 CPython/3.9.2

Release files / domain_name_label_indexes-0.1.1-py2.py3-none-any.whl

Download URL domain_name_label_indexes-0.1.1-py2.py3-none-any.whl
Size 5.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
c693bcb968c5f24c786a66a03294aba0ae486bc8e30ae2102cf47fdeac9b90f3
BLAKE2b-256 checksum
How to use checksums
fb208c15f023a5f7fecf966c860b68499d8a95dd15ec78f31498392ee50c6f9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.14.0 pkginfo/1.9.2 requests/2.28.1 setuptools/44.1.1 requests-toolbelt/0.10.1 tqdm/4.64.1 CPython/3.9.2

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.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