Skip to main content

Domain name and ownership validation package for Python

Project description

Domain Validator Logo Tests Coverage PyPI - Python Version PyPI - Version PyPI - Status Black

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


Download files

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

Source Distribution

domain_validator-0.2.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

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

domain_validator-0.2.0-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

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

Hashes for domain_validator-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9a601710e2176d4705533f1568799ad1e6c0ef73798055fa7ec90082a522e8a1
MD5 225c7d100f88fd389d96f1ad6b751782
BLAKE2b-256 862fc2f9a020cfe7602912d3c56b0d1786d7ef6af4d5d6e86a635b923721099d

See more details on using hashes here.

Provenance

The following attestation bundles were made for domain_validator-0.2.0.tar.gz:

Publisher: release.yml on stacynoland/domain-validator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file domain_validator-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for domain_validator-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ebc20c4c3a4fa1f464e720fa2289a1bfce1c97bf64227cbb049e4e10159ecbbc
MD5 063d0bac44a46766923ea15a2c10185b
BLAKE2b-256 42e9d80305003d017c47c0545a723182dc7f1dc1eedfdabbf43295e0030a18d7

See more details on using hashes here.

Provenance

The following attestation bundles were made for domain_validator-0.2.0-py3-none-any.whl:

Publisher: release.yml on stacynoland/domain-validator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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