Async-compatible Python module for retrieving WHOIS information for domains.
Project description
##################
asyncwhois
##################
Async-compatible Python module for retrieving WHOIS information of domains. Based on richardpenman/pywhois
_
Installation
.. code-block:: bash
pip install asyncwhois
Examples
asyncio
.. code-block:: python
import asyncio
import time
import asyncwhois
async def main():
urls = [
'https://www.google.co.uk',
'en.wikipedia.org/wiki/Pi',
'https://www.urbandictionary.com/define.php?term=async',
'twitch.tv',
'reuters.com',
'https://www.pcpartpicker.com',
'https://packaging.python.org/',
'imgur.com'
]
tasks = []
for url in urls:
awaitable = asyncwhois.lookup(url)
tasks.append(awaitable)
await asyncio.gather(*tasks)
if __name__ == '__main__':
start = time.time()
asyncio.run(main())
print(f'Done! [{round(time.time() - start, 4)}] seconds.')
aiohttp
.. code-block:: python
from aiohttp import web
import asyncwhois
async def whois(request):
domain = request.match_info.get('domain', 'google.com')
result = await asyncwhois.lookup(domain)
return web.Response(text=f'WhoIs parsed:\n{result}')
app = web.Application()
app.add_routes([web.get('/whois/{domain}', whois)])
web.run_app(app)
References:
.. target-notes::
.. _richardpenman/pywhois
: https://github.com/richardpenman/pywhois
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
asyncwhois-0.1.0.tar.gz
(17.0 kB
view hashes)
Built Distribution
asyncwhois-0.1.0-py3-none-any.whl
(18.0 kB
view hashes)
Close
Hashes for asyncwhois-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae24a03feef7db4d352a8851fbdf589a3fe43aac54ba50e2702184059db45030 |
|
MD5 | 0efd49aae0b72b4caefb520f0616bfcd |
|
BLAKE2b-256 | c7163d6cd866f763f53a5b8e07501f30d3625d6c858322d1185d81415faf951f |