Checks wildcard domain names
Project description
Wildhost
Checks wildcard domain names.
Install
pip install wildhost
Usage
Import the module
>>> import wildhost
Pass a hostname to the check
function.
>>> wildhost.check('foo.bar.domain.tld')
If none of the levels of the name are wildcards, None
will be returned.
>>> wildhost.check('mail.google.com')
This returns None
as neither google.com
nor mail.google.com
are wildcards.
For a wildcard name, the lowest level wildcard name will be returned.
>>> wildhost.check('foo.bar.spam.grok.sharefile.com')
'sharefile.com'
Performance
The module caches the wildcard results and uses them in further checks. For example:
>>> wildhost.check('foo.bar.spam.grok.sharefile.com') # this will be a fresh check
'sharefile.com'
>>> wildhost.check('boom.blast.sharefile.com') # this will use the cache
'sharefile.com'
Once sharefile.com
is known to be a wildcard, any further subdomains of sharefile.com
will be evaluated as wildcards as well. This is determined from a static check and therefore very fast.
However, there is a caveat. In an unlikely scenario, api.sharefile.com
will be missed, if it happens to be a valid subdomain.
In such cases, when in doubt, use the wildcard.check_fresh
function to ignore the cache.
>>> wildcard.check_fresh('api.sharefile.com')
This will return None
if it is, in fact, not a wildcard.
check_fresh
needs to make network requests, where ascheck
caches the results and is very fast. Choose one that is suitable for the problem at hand.
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
Built Distribution
File details
Details for the file wildhost-0.0.4.tar.gz
.
File metadata
- Download URL: wildhost-0.0.4.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.23.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e8f6b84b87d7ce2c17f3f90c573d308d9caabe8ebe0ff2e545bc907ba468d52 |
|
MD5 | 7338957965c296630ce4483b73418467 |
|
BLAKE2b-256 | d233be20ddc95562e7edb914f305784eb9675c2fb512a928aaf857b4fad2312e |
File details
Details for the file wildhost-0.0.4-py2.py3-none-any.whl
.
File metadata
- Download URL: wildhost-0.0.4-py2.py3-none-any.whl
- Upload date:
- Size: 3.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.23.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 766145fc7e8c1df1fc1c78bf5532dfb156d78ab1c454e8fe233b56339b8951e1 |
|
MD5 | ccc411a201cd470f50839b6397c8c428 |
|
BLAKE2b-256 | 8f1c480772d422526409223a61fb0f3ae0971e12bdc180fde83b5467cf5d98a2 |