summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorBob Halley <halley@dnspython.org>2020-09-03 07:09:01 -0700
committerBob Halley <halley@dnspython.org>2020-09-03 07:09:01 -0700
commit64f7f10985ace2be955a4b1cca9ff95143dcab38 (patch)
treebe3048c8bd7a0bcfbbc3d0c8b5a9a8cb2c92176a /examples
parent3d23925701f1c97f2e324d3afb74eaad79ea6289 (diff)
downloaddnspython-64f7f10985ace2be955a4b1cca9ff95143dcab38.tar.gz
fix trio example
Diffstat (limited to 'examples')
-rw-r--r--[-rwxr-xr-x]examples/async_dns.py (renamed from examples/trio.py)15
1 files changed, 8 insertions, 7 deletions
diff --git a/examples/trio.py b/examples/async_dns.py
index 4f65e44..c42defc 100755..100644
--- a/examples/trio.py
+++ b/examples/async_dns.py
@@ -1,10 +1,11 @@
import sys
+
import trio
import dns.message
-import dns.trio.query
-import dns.trio.resolver
+import dns.asyncquery
+import dns.asyncresolver
async def main():
if len(sys.argv) > 1:
@@ -12,17 +13,17 @@ async def main():
else:
host = 'www.dnspython.org'
q = dns.message.make_query(host, 'A')
- r = await dns.trio.query.udp(q, '8.8.8.8')
+ r = await dns.asyncquery.udp(q, '8.8.8.8')
print(r)
q = dns.message.make_query(host, 'A')
- r = await dns.trio.query.stream(q, '8.8.8.8')
+ r = await dns.asyncquery.tcp(q, '8.8.8.8')
print(r)
q = dns.message.make_query(host, 'A')
- r = await dns.trio.query.stream(q, '8.8.8.8', tls=True)
+ r = await dns.asyncquery.tls(q, '8.8.8.8')
print(r)
- a = await dns.trio.resolver.resolve(host, 'A')
+ a = await dns.asyncresolver.resolve(host, 'A')
print(a.response)
- zn = await dns.trio.resolver.zone_for_name(host)
+ zn = await dns.asyncresolver.zone_for_name(host)
print(zn)
if __name__ == '__main__':