]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
fix trio example
authorBob Halley <halley@dnspython.org>
Thu, 3 Sep 2020 14:09:01 +0000 (07:09 -0700)
committerBob Halley <halley@dnspython.org>
Thu, 3 Sep 2020 14:09:01 +0000 (07:09 -0700)
examples/async_dns.py [moved from examples/trio.py with 57% similarity, mode: 0644]

old mode 100755 (executable)
new mode 100644 (file)
similarity index 57%
rename from examples/trio.py
rename to examples/async_dns.py
index 4f65e44..c42defc
@@ -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__':