Metadata-Version: 2.4 Name: aiohttp-asyncmdnsresolver Version: 0.2.0 Summary: An async resolver for aiohttp that supports MDNS License-Expression: Apache-2.0 Project-URL: Homepage, https://github.com/aio-libs/aiohttp-asyncmdnsresolver Project-URL: Issues, https://github.com/aio-libs/aiohttp-asyncmdnsresolver/issues Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Classifier: Programming Language :: Python :: 3.12 Classifier: Programming Language :: Python :: 3.13 Classifier: Programming Language :: Python :: 3.14 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Operating System :: OS Independent Classifier: Intended Audience :: Developers Classifier: Topic :: Internet :: WWW/HTTP Classifier: Framework :: AsyncIO Classifier: Framework :: aiohttp Classifier: Development Status :: 5 - Production/Stable Classifier: Typing :: Typed Requires-Python: >=3.10 Description-Content-Type: text/x-rst License-File: LICENSE Requires-Dist: aiodns>=3.2.0 Requires-Dist: aiohttp>=3.10.0 Requires-Dist: zeroconf>=0.142.0 Dynamic: license-file aiohttp-asyncmdnsresolver ========================= .. image:: https://github.com/aio-libs/aiohttp-asyncmdnsresolver/actions/workflows/ci-cd.yml/badge.svg :target: https://github.com/aio-libs/aiohttp-asyncmdnsresolver/actions?query=workflow%3ACI :align: right .. image:: https://codecov.io/gh/aio-libs/aiohttp-asyncmdnsresolver/branch/main/graph/badge.svg :target: https://codecov.io/gh/aio-libs/aiohttp-asyncmdnsresolver .. image:: https://badge.fury.io/py/aiohttp-asyncmdnsresolver.svg :target: https://badge.fury.io/py/aiohttp-asyncmdnsresolver .. image:: https://readthedocs.org/projects/aiohttp-asyncmdnsresolver/badge/?version=latest :target: https://aiohttp-asyncmdnsresolver.readthedocs.io .. image:: https://img.shields.io/pypi/pyversions/aiohttp-asyncmdnsresolver.svg :target: https://pypi.org/p/aiohttp-asyncmdnsresolver .. image:: https://img.shields.io/matrix/aio-libs:matrix.org?label=Discuss%20on%20Matrix%20at%20%23aio-libs%3Amatrix.org&logo=matrix&server_fqdn=matrix.org&style=flat :target: https://matrix.to/#/%23aio-libs:matrix.org :alt: Matrix Room — #aio-libs:matrix.org .. image:: https://img.shields.io/matrix/aio-libs-space:matrix.org?label=Discuss%20on%20Matrix%20at%20%23aio-libs-space%3Amatrix.org&logo=matrix&server_fqdn=matrix.org&style=flat :target: https://matrix.to/#/%23aio-libs-space:matrix.org :alt: Matrix Space — #aio-libs-space:matrix.org Introduction ------------ 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. Installation ------------ .. code-block:: console $ pip install aiohttp-asyncmdnsresolver Quick start ----------- .. code-block:: python import asyncio import aiohttp from aiohttp_asyncmdnsresolver.api import AsyncMDNSResolver async def main(): resolver = AsyncMDNSResolver() # aiohttp does not own a resolver passed to TCPConnector, so close it here. try: 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) finally: await resolver.close() asyncio.run(main()) Resolving with both mDNS and DNS -------------------------------- ``AsyncDualMDNSResolver`` is a variant that resolves ``.local`` names over mDNS **and** regular DNS concurrently, returning the first successful result. Use it when a ``.local`` name may be served by a unicast DNS server as well as mDNS. .. code-block:: python import asyncio import aiohttp from aiohttp_asyncmdnsresolver.api import AsyncDualMDNSResolver async def main(): resolver = AsyncDualMDNSResolver() # aiohttp does not own a resolver passed to TCPConnector, so close it here. try: connector = aiohttp.TCPConnector(resolver=resolver) async with aiohttp.ClientSession(connector=connector) as session: async with session.get('http://printer.local.') as response: print(response.status) finally: await resolver.close() asyncio.run(main()) API documentation ----------------- The documentation is located at https://aiohttp-asyncmdnsresolver.readthedocs.io. Source code ----------- 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. Authors and License ------------------- It's *Apache 2* licensed and freely available. .. _GitHub: https://github.com/aio-libs/aiohttp-asyncmdnsresolver