···11import aiohttp
22-import dns.resolver as dns
22+import aiodns
33from re import match as regex_match
44from typing import Any
55···33333434 if is_valid_handle(query):
3535 handle = query.lower()
3636- did = resolve_did_from_handle(handle, didkv)
3636+ did = await resolve_did_from_handle(handle, didkv)
3737 if not did:
3838 return None
3939 doc = await resolve_doc_from_did(did)
···5252 handle = handle_from_doc(doc)
5353 if not handle:
5454 return None
5555- if resolve_did_from_handle(handle, didkv) != did:
5555+ if await resolve_did_from_handle(handle, didkv) != did:
5656 return None
5757 return (did, handle, doc)
5858···7979 return None
808081818282-def resolve_did_from_handle(
8282+async def resolve_did_from_handle(
8383 handle: str,
8484 kv: KV = nokv,
8585 reload: bool = False,
···9494 print(f"returning cached did for {handle}")
9595 return did
96969797+ resolver = aiodns.DNSResolver()
9798 try:
9898- answer = dns.resolve(f"_atproto.{handle}", "TXT")
9999- except dns.NXDOMAIN:
9999+ result = await resolver.query(f"_atproto.{handle}", "TXT")
100100+ except aiodns.error.DNSError:
100101 return None
101102102102- for record in answer:
103103- value = str(record).replace('"', "")
103103+ for record in result:
104104+ value = str(record.text).replace('"', "")
104105 if value.startswith("did="):
105106 did = value[4:]
106107 if is_valid_did(did):
+1-1
src/main.py
···49495050 if atid.startswith("@"):
5151 handle = atid[1:].lower()
5252- did = resolve_did_from_handle(handle, reload=reload)
5252+ did = await resolve_did_from_handle(handle, reload=reload)
5353 if did is None:
5454 return render_template("error.html", message="did not found"), 404
5555 elif is_valid_did(atid):