Skip to content

Latest commit

 

History

History
88 lines (56 loc) · 2.79 KB

README.rst

File metadata and controls

88 lines (56 loc) · 2.79 KB

aiohttp-asyncmdnsresolver

https://readthedocs.org/projects/aiohttp-asyncmdnsresolver/badge/?version=latest Matrix Room — #aio-libs:matrix.org 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

$ pip install aiohttp-asyncmdnsresolver

Quick start

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())

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.