@@ -10,7 +10,7 @@ getdns: Python bindings for getdns
10
10
for the `getdns <http://getdnsapi.net/ >`_ API. getdns is a
11
11
modern, asynchronous DNS API that simplifies access to
12
12
advanced DNS features, including DNSSEC. The API
13
- `specification <http://www.vpnc.org/getdns-api / >`_ was
13
+ `specification <http://getdnsapi.net/spec / >`_ was
14
14
developed by Paul Hoffman. getdns is built on top of the
15
15
getdns implementation developed as a joint project between
16
16
`Verisign Labs
@@ -86,7 +86,7 @@ examined directly, and the overall state of a given context can be
86
86
queried with the Context.get_api_information() method.
87
87
88
88
See section 8 of the `API
89
- specification <http://www.vpnc.org/getdns-api /> `_
89
+ specification <http://getdnsapi.net/spec /> `_
90
90
91
91
92
92
Examples
@@ -105,20 +105,21 @@ results to the screen:
105
105
sys.exit(1 )
106
106
107
107
ctx = getdns.Context()
108
- extensions = { " return_both_v4_and_v6" : getdns.GETDNS_EXTENSION_TRUE }
109
- results = ctx.address(name = sys.argv[1 ], extensions = extensions)
110
- if results[" status" ] == getdns.GETDNS_RESPSTATUS_GOOD :
108
+ extensions = { " return_both_v4_and_v6" :
109
+ getdns.GETDNS_EXTENSION_TRUE }
110
+ results = ctx.address(name = sys.argv[1 ],
111
+ extensions = extensions)
112
+ if results.status == getdns.RESPSTATUS_GOOD :
111
113
sys.stdout.write(" Addresses: " )
112
-
113
- for addr in results[ " just_address_answers" ] :
114
+
115
+ for addr in results. just_address_answers:
114
116
print " {0} " .format(addr[" address_data" ])
115
117
sys.stdout.write(" \n\n " )
116
118
print " Entire results tree: "
117
- pprint.pprint(results)
118
- if results[ " status" ] == getdns.GETDNS_RESPSTATUS_NO_NAME :
119
+ pprint.pprint(results.replies_tree )
120
+ if results. status == getdns.RESPSTATUS_NO_NAME :
119
121
print " {0} not found" .format(sys.argv[1 ])
120
122
121
-
122
123
if __name__ == " __main__" :
123
124
main()
124
125
@@ -149,27 +150,31 @@ In this example, we do a DNSSEC query and check the response:
149
150
sys.exit(1 )
150
151
151
152
ctx = getdns.Context()
152
- extensions = { " return_both_v4_and_v6" : getdns.GETDNS_EXTENSION_TRUE ,
153
- " dnssec_return_status" : getdns.GETDNS_EXTENSION_TRUE }
154
- results = ctx.address(name = sys.argv[1 ], extensions = extensions)
155
- if results[" status" ] == getdns.GETDNS_RESPSTATUS_GOOD :
153
+ extensions = { " return_both_v4_and_v6" :
154
+ getdns.EXTENSION_TRUE ,
155
+ " dnssec_return_status" :
156
+ getdns.EXTENSION_TRUE }
157
+ results = ctx.address(name = sys.argv[1 ],
158
+ extensions = extensions)
159
+ if results.status == getdns.RESPSTATUS_GOOD :
156
160
sys.stdout.write(" Addresses: " )
157
- for addr in results[ " just_address_answers" ] :
161
+ for addr in results. just_address_answers:
158
162
print " {0} " .format(addr[" address_data" ])
159
163
sys.stdout.write(" \n " )
160
164
161
- for result in results[ " replies_tree" ] :
165
+ for result in results. replies_tree:
162
166
if " dnssec_status" in result.keys():
163
- print " {0} : dnssec_status: {1} " .format(result[" canonical_name" ],
167
+ print " {0} : dnssec_status:
168
+ {1 }" .format(result[" canonical_name" ],
164
169
dnssec_message(result[" dnssec_status" ]))
165
170
166
- if results[ " status" ] == getdns.GETDNS_RESPSTATUS_NO_NAME :
171
+ if results. status == getdns.RESPSTATUS_NO_NAME :
167
172
print " {0} not found" .format(sys.argv[1 ])
168
173
169
174
170
175
if __name__ == " __main__" :
171
176
main()
172
-
177
+
173
178
174
179
Known issues
175
180
============
0 commit comments