https://github.com/rs/domcheck
A Python library to validate the ownership of a domain using different strategies
https://github.com/rs/domcheck
Last synced: 9 months ago
JSON representation
A Python library to validate the ownership of a domain using different strategies
- Host: GitHub
- URL: https://github.com/rs/domcheck
- Owner: rs
- License: mit
- Created: 2015-04-16T07:39:49.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2021-06-29T17:08:36.000Z (almost 5 years ago)
- Last Synced: 2025-04-14T10:04:30.040Z (about 1 year ago)
- Language: Python
- Size: 20.5 KB
- Stars: 47
- Watchers: 4
- Forks: 13
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
Domcheck: Domain Ownership Validation
=====================================
.. image:: https://img.shields.io/pypi/v/domcheck.svg
:target: https://pypi.python.org/pypi/domcheck
.. image:: https://travis-ci.org/rs/domcheck.svg?branch=master
:target: https://travis-ci.org/rs/domcheck
This Python library implements different strategies to validate the ownership of a domain name.
Available strategies
--------------------
All strategies takes 3 arguments: the domain to check, a static DNS safe ``prefix`` like "yourservice-domain-verification" and a randomly generated ``code``.
- **DNS TXT record**: checks for the ``{prefix}-{code}`` string present in one of the ``TXT`` records on the domain name.
- **DNS CNAME record**: checks for the existence of ``CNAME` record composed on the static ``{prefix}-{code}`` on the domain pointing to domain (usually yours) which the host is {prefix} (i.e.: {prefix}.yourdomain.com). NOTE: you may want to make sure that {prefix}.yourdomain.com resolves to something as some zone editors may check that.
- **Meta Tag**: checks for the presence of a ```` tag in the ```` part of the domain's home page using either HTTP or HTTPs protocols.
- **HTML File**: checks for the presence of a file named ``{code}.html`` at the root of the domain's website containing the string ``{prefix}={code}`` using either HTTP or HTTPs protocols.
Usage Example
-------------
Simple usage will check the domain with all available strategies and return ``True`` if the validation passed:
.. code-block:: python
import domcheck
domain = "example.com"
prefix = "myservice-domain-verification"
code = "myserviceK2d8a0xdhh"
if domcheck.check(domain, prefix, code):
print("This domain is verified")
You may filter strategies by passing a coma separated list of strategies:
.. code-block:: python
domcheck.check(domain, prefix, code, strategies="dns_txt,meta_tag")
Installation
------------
To install domcheck, simply:
$ pip install domcheck
Licenses
--------
All source code is licensed under the `MIT License `_.