Skip to main content

aiohttp-doh

DNS over HTTPS reslover for aiohttp

Installation

$ 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=[
        'https://cloudflare-dns.com/dns-query',
    ])
    connector = TCPConnector(resolver=resolver)
    return ClientSession(*args, **kwargs, connector=connector)

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

    print(data)

Shortcut

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('http://example.com') as resp:
            data = await resp.text()

    print(data)

Options

You can pass below parameter for configuration.

endpoints

List of str. DNS over HTTPS endpoints. Shortcut use ‘https://dns.google.com/resolve’ and ‘https://cloudflare-dns.com/dns-query’ both in default. You can also use others instead.

json_loads

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

resolver_class

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

License

MIT

Metadata

Release files for aiohttp-doh 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiohttp-doh 0.2.1
File Size Uploaded Provenance Actions
aiohttp-doh-0.2.1.tar.gz 2.9 kB Without provenance Details for aiohttp-doh-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aiohttp-doh 0.2.1
File Interpreter ABI Platform Actions
aiohttp_doh-0.2.1-py3-none-any.whl Python 3 none any Details for aiohttp_doh-0.2.1-py3-none-any.whl

Total release size: 7.9 kB

Release files / aiohttp-doh-0.2.1.tar.gz

Download URL aiohttp-doh-0.2.1.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
2d464c66c7db87fee815f8f6ac80ac4a0181a632801584210d4b24b5815a7c37
BLAKE2b-256 checksum
How to use checksums
d160046bd2a9e23fd15ef0eef3559f07d2348f5816deb99e1bd10823140196ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/0.12.11 CPython/3.7.2 Darwin/18.2.0

Release files / aiohttp_doh-0.2.1-py3-none-any.whl

Download URL aiohttp_doh-0.2.1-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4ad9ede46cc1f58b007bb9283c7eb564cda580cd76b33d8f853a2605997ba222
BLAKE2b-256 checksum
How to use checksums
2e22aa7965a87212c17fcf4d80e7f79adb1479b116c4b4f3996b9149ada0a913
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/0.12.11 CPython/3.7.2 Darwin/18.2.0

Security for aiohttp-doh 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page