Skip to main content

DNS over HTTPS reslover for aiohttp

Project description

DNS over HTTPS reslover for aiohttp


$ pip install aiohttp-doh

Manual Usage

If you want use manualy, you must import ClientSession in aiohttp.client module and TCPConnector in aiohttp.connector module and DNSOverHTTPSResolver in aiohttp_doh package.

from aiohttp.client import ClientSession
from aiohttp.connector import TCPConnector

from aiohttp_doh import DNSOverHTTPSResolver

def my_client_session(*args, **kwargs):
    resolver = DNSOverHTTPSResolver(endpoints=[
    connector = TCPConnector(resolver=resolver)
    return ClientSession(*args, **kwargs, connector=connector)

 async def main():
    async with my_client_session() as session:
        async with session.get('') as resp:
            data = await resp.text()



Manual usage is too board. So I make shortcut to use easily. You just replace aiohttp.ClientSession to aiohttp_doh.ClientSession.

from aiohttp_doh import ClientSession

async def main():
    async with ClientSession() as session:
        async with session.get('') as resp:
            data = await resp.text()



You can pass below parameter for configuration.


List of str. DNS over HTTPS endpoints. Shortcut use ‘’ and ‘’ both in default. You can also use others instead.


Function for loads json. default is Python builtin json module’s one. You can use third-party json library like simplejson or ujson.


Internal DNS resolver class. Using for connect to endpoint. default is aiohttp default.



Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiohttp-doh-0.2.1.tar.gz (2.9 kB view hashes)

Uploaded Source

Built Distribution

aiohttp_doh-0.2.1-py3-none-any.whl (5.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page