Skip to main content

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)

.. _richardpenman/pywhois: https://github.com/richardpenman/pywhois

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

asyncwhois-0.1.1.tar.gz (88.4 kB view details)

Uploaded Source

Built Distribution

asyncwhois-0.1.1-py3-none-any.whl (90.1 kB view details)

Uploaded Python 3

File details

Details for the file asyncwhois-0.1.1.tar.gz.

File metadata

  • Download URL: asyncwhois-0.1.1.tar.gz
  • Upload date:
  • Size: 88.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for asyncwhois-0.1.1.tar.gz
Algorithm Hash digest
SHA256 50288a3872aa249e9a82d69f5958602111ca758362fe9322e2b736cd6008c4f6
MD5 cce6605fcc0fe9b39cd5ecff2213a8a4
BLAKE2b-256 66e61dc4b31eb344808077b930a849f63242ea372fa482f999ea9a27277efc5e

See more details on using hashes here.

File details

Details for the file asyncwhois-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: asyncwhois-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 90.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for asyncwhois-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 473dda23c8e4b1a989c4839d23bfa559641bf2115f0acbca7bfa548a2600941b
MD5 caf062e13ee0d06724428752b6980d92
BLAKE2b-256 948cfd819b7826aa94b803229496b7001bdc57dad9ec7037fbfbbc90e32fafe2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page