summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Halley <halley@dnspython.org>2021-11-07 10:27:04 -0800
committerGitHub <noreply@github.com>2021-11-07 10:27:04 -0800
commitb4e36f0a414de62bf755dcaab87b718574f6d04a (patch)
tree37f91e7a4a823c360904979e5139a549f811f179
parent02b02c53908e29ad2b744376f5b844308c31a425 (diff)
parent51e28f301d625792c565df2f2220d5dd45e6ad50 (diff)
downloaddnspython-b4e36f0a414de62bf755dcaab87b718574f6d04a.tar.gz
Merge pull request #719 from paulehoffman/rd=0-example
Extended the example to include one with RD=0
-rw-r--r--examples/query_specific.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/examples/query_specific.py b/examples/query_specific.py
index f0121fb..fcbfc24 100644
--- a/examples/query_specific.py
+++ b/examples/query_specific.py
@@ -35,3 +35,13 @@ answer = resolver.resolve('amazon.com', 'NS')
print('The nameservers are:')
for rr in answer:
print(rr.target)
+
+# Sending a query with the RD flag set to 0
+# This sends a query with RD=0 for the root SOA RRset to the IP address for l.root-servers.net
+
+q = dns.message.make_query('.', dns.rdatatype.SOA)
+# Set the RD flag to 0
+q.flags &= ~dns.flags.RD
+r = dns.query.udp(q, '199.7.83.42')
+print('\nThe flags in the response are {}'.format(dns.flags.to_text(r.flags)))
+print('The SOA in the response is "{}"'.format((r.answer)[0][0]))