example-code-2e/22-async/domains
2021-05-21 18:56:12 -03:00
..
asyncio renamed 22-async/ 2021-03-11 16:11:39 -03:00
curio updade from Atlas repo 2021-05-21 18:56:12 -03:00
README.rst update from O'Reilly repo 2021-03-22 12:24:21 -03:00

domainlib demonstration
=======================

Run Python's async console (requires Python ≥ 3.8)::

    $ python3 -m asyncio

I'll see ``asyncio`` imported automatically::

    >>> import asyncio

Now you can experiment with ``domainlib``.

At the `>>>` prompt, type these commands::

    >>> from domainlib import *
    >>> await probe('python.org')

Note the result.

Next::

    >>> names = 'python.org rust-lang.org golang.org n05uch1an9.org'.split()
    >>> async for result in multi_probe(names):
    ...     print(*result, sep='\t')

Note that if you run the last two lines again,
the results are likely to appear in a different order.