This module provides an aiohttp
resolver that supports mDNS, which uses the zeroconf
library
to resolve mDNS queries.
For full documentation please read https://aiohttp-asyncmdnsresolver.readthedocs.io.
$ pip install aiohttp-asyncmdnsresolver
import asyncio
import aiohttp
from aiohttp_asyncmdnsresolver.api import AsyncMDNSResolver
async def main():
resolver = AsyncMDNSResolver()
connector = aiohttp.TCPConnector(resolver=resolver)
async with aiohttp.ClientSession(connector=connector) as session:
async with session.get('http://example.com') as response:
print(response.status)
async with session.get('http://xxx.local.') as response:
print(response.status)
asyncio.run(main())
The documentation is located at https://aiohttp-asyncmdnsresolver.readthedocs.io.
The project is hosted on GitHub
Please file an issue on the bug tracker if you have found a bug or have some suggestion in order to improve the library.
It's Apache 2 licensed and freely available.