Metadata-Version: 2.1
Name: asyncwhois
Version: 0.1.1
Summary: Async-compatible Python module for retrieving WHOIS information for domains.
Home-page: https://github.com/pogzyb/asyncwhois
Author: Joseph Obarzanek
Author-email: pogzyb@umich.edu
License: UNKNOWN
Platform: UNKNOWN
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Programming Language :: Python :: 3
Classifier: Framework :: AsyncIO
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: aiodns

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


