Domain name and ownership validation package for Python
Project description
domain-validator
A Python package for validating domain names, checking their DNS resolution, and converting between Unicode and Punycode formats. The package also provides a method to generate a random code for TXT records which can be added to a domain's DNS for verifying ownership.
Installation
To install the package, you can use pip or a dependency manager like Poetry:
pip install domain-validator
or
poetry add domain-validator
Usage
from domain_validator import DomainValidator
# Create a DomainValidator instance
validator = DomainValidator()
# Verify domain matches valid pattern
validator.validate_domain_re("example.com")
# Check against maximum domain length
validator.validate_domain_length("example.com")
# Verify domain resolves and is not a reserved domain
validator.validate_domain_dns("example.com")
# Verify domain passes all three methods:
# validate_domain_re, validate_domain_length, and validate_domain_dns
validator.is_domain_valid("example.com")
# Returns Punycode version of domain - only available when ascii_only is False
validator.unicode_to_punycode("例子.测试")
# Returns Unicode version of domain - only available when ascii_only is False
validator.punycode_to_unicode("xn--fsqu00a.xn--0zwm56d")
# Generate a random code for TXT record verification with optional prefix
validator.generate_txt_code("example.com", prefix="myservice")
# Validate domain ownership by checking for TXT record
validator.validate_domain_ownership("example.com", "myservice=84yfCdasrZejOPNeFuBpgGXcvy")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file domain_validator-0.2.0.tar.gz.
File metadata
- Download URL: domain_validator-0.2.0.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a601710e2176d4705533f1568799ad1e6c0ef73798055fa7ec90082a522e8a1
|
|
| MD5 |
225c7d100f88fd389d96f1ad6b751782
|
|
| BLAKE2b-256 |
862fc2f9a020cfe7602912d3c56b0d1786d7ef6af4d5d6e86a635b923721099d
|
Provenance
The following attestation bundles were made for domain_validator-0.2.0.tar.gz:
Publisher:
release.yml on stacynoland/domain-validator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
domain_validator-0.2.0.tar.gz -
Subject digest:
9a601710e2176d4705533f1568799ad1e6c0ef73798055fa7ec90082a522e8a1 - Sigstore transparency entry: 220395350
- Sigstore integration time:
-
Permalink:
stacynoland/domain-validator@786c71d2a4819e26e5eefb14ede261822ebaf5e5 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/stacynoland
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@786c71d2a4819e26e5eefb14ede261822ebaf5e5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file domain_validator-0.2.0-py3-none-any.whl.
File metadata
- Download URL: domain_validator-0.2.0-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ebc20c4c3a4fa1f464e720fa2289a1bfce1c97bf64227cbb049e4e10159ecbbc
|
|
| MD5 |
063d0bac44a46766923ea15a2c10185b
|
|
| BLAKE2b-256 |
42e9d80305003d017c47c0545a723182dc7f1dc1eedfdabbf43295e0030a18d7
|
Provenance
The following attestation bundles were made for domain_validator-0.2.0-py3-none-any.whl:
Publisher:
release.yml on stacynoland/domain-validator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
domain_validator-0.2.0-py3-none-any.whl -
Subject digest:
ebc20c4c3a4fa1f464e720fa2289a1bfce1c97bf64227cbb049e4e10159ecbbc - Sigstore transparency entry: 220395355
- Sigstore integration time:
-
Permalink:
stacynoland/domain-validator@786c71d2a4819e26e5eefb14ede261822ebaf5e5 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/stacynoland
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@786c71d2a4819e26e5eefb14ede261822ebaf5e5 -
Trigger Event:
push
-
Statement type: