@@ -33,12 +33,12 @@ as its methods and attributes.
33
33
34
34
Specifies whether DNS queries are performed with
35
35
nonrecursive lookups or as a stub resolver. The value is
36
- either ``getdns.GETDNS_RESOLUTION_RECURSING `` or
37
- ``getdns.GETDNS_RESOLUTION_STUB ``.
36
+ either ``getdns.RESOLUTION_RECURSING `` or
37
+ ``getdns.RESOLUTION_STUB ``.
38
38
39
39
If an implementation of this API is only able to act as a
40
40
recursive resolver, setting `resolution_type `
41
- to ``getdns.GETDNS_RESOLUTION_STUB `` will throw an exception.
41
+ to ``getdns.RESOLUTION_STUB `` will throw an exception.
42
42
43
43
.. py :attribute :: namespaces
44
44
@@ -47,9 +47,9 @@ as its methods and attributes.
47
47
setting is ignored for the getdns.general() function;
48
48
it is used for the other
49
49
functions. *) The allowed values are
50
- ``getdns.GETDNS_NAMESPACE_DNS ``, ``getdns.GETDNS_NAMESPACE_LOCALNAMES ``,
51
- ``getdns.GETDNS_NAMESPACE_NETBIOS ``,
52
- ``getdns.GETDNS_NAMESPACE_MDNS ``, and ``getdns.GETDNS_NAMESPACE_NIS ``. When a
50
+ ``getdns.NAMESPACE_DNS ``, ``getdns.NAMESPACE_LOCALNAMES ``,
51
+ ``getdns.NAMESPACE_NETBIOS ``,
52
+ ``getdns.NAMESPACE_MDNS ``, and ``getdns.NAMESPACE_NIS ``. When a
53
53
normal lookup is done, the API does the lookups in the
54
54
order given and stops when it gets the first result; a
55
55
different method with the same result would be to run the
@@ -62,9 +62,9 @@ as its methods and attributes.
62
62
.. py :attribute :: dns_transport
63
63
64
64
Specifies what transport is used for DNS lookups. The
65
- value must be one of ``getdns.GETDNS_TRANSPORT_UDP_FIRST_AND_FALL_BACK_TO_TCP ``,
66
- ``getdns.GETDNS_TRANSPORT_UDP_ONLY ``, ``getdns.GETDNS_TRANSPORT_TCP_ONLY ``, or
67
- ``getdns.GETDNS_TRANSPORT_TCP_ONLY_KEEP_CONNECTIONS_OPEN ``.
65
+ value must be one of ``getdns.TRANSPORT_UDP_FIRST_AND_FALL_BACK_TO_TCP ``,
66
+ ``getdns.TRANSPORT_UDP_ONLY ``, ``getdns.TRANSPORT_TCP_ONLY ``, or
67
+ ``getdns.TRANSPORT_TCP_ONLY_KEEP_CONNECTIONS_OPEN ``.
68
68
69
69
.. py :attribute :: limit_outstanding_queries
70
70
@@ -77,9 +77,9 @@ as its methods and attributes.
77
77
.. py :attribute :: follow_redirects
78
78
79
79
Specifies whether or not DNS queries follow
80
- redirects. The value must be one of ``getdns.GETDNS_REDIRECTS_FOLLOW `` for
80
+ redirects. The value must be one of ``getdns.REDIRECTS_FOLLOW `` for
81
81
normal following of redirects though CNAME and DNAME; or
82
- ``getdns.GETDNS_REDIRECTS_DO_NOT_FOLLOW `` to cause any lookups that
82
+ ``getdns.REDIRECTS_DO_NOT_FOLLOW `` to cause any lookups that
83
83
would have gone through CNAME and DNAME to return the
84
84
CNAME or DNAME, not the eventual target.
85
85
@@ -105,10 +105,10 @@ as its methods and attributes.
105
105
Specifies whether to append a suffix to the query string
106
106
before the API starts resolving a name. Its value must be
107
107
one of
108
- ``getdns.GETDNS_APPEND_NAME_ALWAYS ``,
109
- ``getdns.GETDNS_APPEND_NAME_ONLY_TO_SINGLE_LABEL_AFTER_FAILURE ``,
110
- ``getdns.GETDNS_APPEND_NAME_ONLY_TO_MULTIPLE_LABEL_NAME_AFTER_FAILURE ``,
111
- or ``getdns.GETDNS_APPEND_NAME_NEVER ``. This controls whether or not
108
+ ``getdns.APPEND_NAME_ALWAYS ``,
109
+ ``getdns.APPEND_NAME_ONLY_TO_SINGLE_LABEL_AFTER_FAILURE ``,
110
+ ``getdns.APPEND_NAME_ONLY_TO_MULTIPLE_LABEL_NAME_AFTER_FAILURE ``,
111
+ or ``getdns.APPEND_NAME_NEVER ``. This controls whether or not
112
112
to append the suffix given by :attr: `suffix `.
113
113
114
114
.. py :attribute :: suffix
@@ -253,7 +253,7 @@ Extensions are Python dictionaries, with the keys being the names of the
253
253
extensions. The definition of each extension describes the values that
254
254
may be assigned to that extension. For most extensions it is a Boolean,
255
255
and since the default value is "False" it will most often take the value
256
- ``getdns.GETDNS_EXTENSION_TRUE ``.
256
+ ``getdns.EXTENSION_TRUE ``.
257
257
258
258
The extensions currently supported by :py:mod: `getdns ` are:
259
259
@@ -279,30 +279,30 @@ a few circumstances.
279
279
To return the DNSSEC status for each DNS record in the
280
280
``replies_tree `` list, use the ``dnssec_return_status ``
281
281
extension. Set the extension's value to
282
- ``getdns.GETDNS_EXTENSION_TRUE `` to cause the returned status to have
282
+ ``getdns.EXTENSION_TRUE `` to cause the returned status to have
283
283
the name ``dnssec_status `` added to the other names in
284
284
the record's dictionary ("header", "question", and so on). The
285
- potential values for that name are ``getdns.GETDNS_DNSSEC_SECURE ``,
286
- ``getdns.GETDNS_DNSSEC_BOGUS ``, ``getdns.GETDNS_DNSSEC_INDETERMINATE ``, and
287
- ``getdns.GETDNS_DNSSEC_INSECURE ``.
285
+ potential values for that name are ``getdns.DNSSEC_SECURE ``,
286
+ ``getdns.DNSSEC_BOGUS ``, ``getdns.DNSSEC_INDETERMINATE ``, and
287
+ ``getdns.DNSSEC_INSECURE ``.
288
288
289
289
If instead of returning the status, you want to only see
290
290
secure results, use the ``dnssec_return_only_secure ``
291
291
extension. The extension's value is set to
292
- ``getdns.GETDNS_EXTENSION_TRUE `` to cause only records that the API can
292
+ ``getdns.EXTENSION_TRUE `` to cause only records that the API can
293
293
validate as secure with DNSSEC to be returned in the
294
294
``replies_tree `` and ``replies_full lists ``. No additional names are
295
295
added to the dict of the record; the change is that some
296
296
records might not appear in the results. When this context
297
297
option is set, if the API receives DNS replies but none are
298
298
determined to be secure, the error code at the top level of
299
- the ``response `` object is ``getdns.GETDNS_RESPSTATUS_NO_SECURE_ANSWERS ``.
299
+ the ``response `` object is ``getdns.RESPSTATUS_NO_SECURE_ANSWERS ``.
300
300
301
301
Applications that want to do their own validation will want
302
302
to have the DNSSEC-related records for a particular
303
303
response. Use the ``dnssec_return_validation_chain ``
304
304
extension. Set the extension's value to
305
- ``getdns.GETDNS_EXTENSION_TRUE `` to cause a set of additional
305
+ ``getdns.EXTENSION_TRUE `` to cause a set of additional
306
306
DNSSEC-related records needed for validation to be returned
307
307
in the ``response object ``. This set comes as ``validation_chain ``
308
308
(a list) at the top level of the ``response `` object. This list
@@ -315,7 +315,7 @@ set, and that request also has any of the
315
315
``dnssec_return_status ``, ``dnssec_return_only_secure ``, or
316
316
``dnssec_return_validation_chain `` extensions specified, the API
317
317
will not perform the request and will instead return an
318
- error of ``getdns.GETDNS_RETURN_DNSSEC_WITH_STUB_DISALLOWED ``.
318
+ error of ``getdns.RETURN_DNSSEC_WITH_STUB_DISALLOWED ``.
319
319
320
320
Returning both IPv4 and IPv6 responses
321
321
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -327,7 +327,7 @@ method is able to do this automatically. If you are
327
327
using the :meth: `general ` method,
328
328
you can enable this with the ``return_both_v4_and_v6 ``
329
329
extension. The extension's value must be set to
330
- ``getdns.GETDNS_EXTENSION_TRUE `` to cause the results to be the lookup
330
+ ``getdns.EXTENSION_TRUE `` to cause the results to be the lookup
331
331
of either A or AAAA records to include any A and AAAA
332
332
records for the queried name (otherwise, the extension does
333
333
nothing). These results are expected to be usable with Happy
@@ -370,20 +370,20 @@ Getting Warnings for Responses that Violate the DNS Standard
370
370
To receive a warning if a particular response violates some
371
371
parts of the DNS standard, use the ``add_warning_for_bad_dns ``
372
372
extension. The extension's value is set to
373
- ``getdns.GETDNS_EXTENSION_TRUE `` to cause each reply in the
373
+ ``getdns.EXTENSION_TRUE `` to cause each reply in the
374
374
``replies_tree `` to contain an additional name, ``bad_dns `` (a
375
375
list). The list is zero or more values that indicate types of
376
376
bad DNS found in that reply. The list of values is:
377
377
378
- .. py :data :: GETDNS_BAD_DNS_CNAME_IN_TARGET
378
+ .. py :data :: BAD_DNS_CNAME_IN_TARGET
379
379
380
380
A DNS query type that does not allow a target to be a CNAME pointed to a CNAME
381
381
382
- .. py :data :: GETDNS_BAD_DNS_ALL_NUMERIC_LABEL
382
+ .. py :data :: BAD_DNS_ALL_NUMERIC_LABEL
383
383
384
384
One or more labels in a returned domain name is all-numeric; this is not legal for a hostname
385
385
386
- .. py :data :: GETDNS_BAD_DNS_CNAME_RETURNED_FOR_OTHER_TYPE
386
+ .. py :data :: BAD_DNS_CNAME_RETURNED_FOR_OTHER_TYPE
387
387
388
388
A DNS query for a type other than CNAME returned a CNAME response
389
389
@@ -403,7 +403,7 @@ An application might want to see debugging information for
403
403
queries, such as the length of time it takes for each query
404
404
to return to the API. Use the ``return_call_debugging ``
405
405
extension. The extension's value is set to
406
- ``getdns.GETDNS_EXTENSION_TRUE `` to add the name ``call_debugging `` (a
406
+ ``getdns.EXTENSION_TRUE `` to add the name ``call_debugging `` (a
407
407
list) to the top level of the ``response `` object. Each member
408
408
of the list is a dict that represents one call made for the
409
409
call to the API. Each member has the following names:
@@ -414,7 +414,7 @@ call to the API. Each member has the following names:
414
414
* ``start_time `` is the time the query started in milliseconds since the epoch, represented as an integer
415
415
* ``end_time `` is the time the query was received in milliseconds since the epoch, represented as an integer
416
416
* ``entire_reply `` is the entire response received
417
- * ``dnssec_result `` is the DNSSEC status, or ``getdns.GETDNS_DNSSEC_NOT_PERFORMED `` if DNSSEC validation was not performed
417
+ * ``dnssec_result `` is the DNSSEC status, or ``getdns.DNSSEC_NOT_PERFORMED `` if DNSSEC validation was not performed
418
418
419
419
420
420
Asynchronous queries
@@ -478,12 +478,12 @@ This is an example callback function:
478
478
def cbk (type , result , userarg , tid ):
479
479
if type == getdns.CALLBACK_COMPLETE :
480
480
status = result.status
481
- if status == getdns.GETDNS_RESPSTATUS_GOOD :
481
+ if status == getdns.RESPSTATUS_GOOD :
482
482
for addr in result.just_address_answers:
483
483
addr_type = addr[' address_type' ]
484
484
addr_data = addr[' address_data' ]
485
485
print ' {0} : {1} {2} ' .format(userarg, addr_type, addr_data)
486
- elif status == getdns.GETDNS_RESPSTATUS_NO_SECURE_ANSWERS :
486
+ elif status == getdns.RESPSTATUS_NO_SECURE_ANSWERS :
487
487
print " {0} : No DNSSEC secured responses found" .format(hostname)
488
488
else :
489
489
print " {0} : getdns.address() returned error: {1} " .format(hostname, status)
@@ -508,7 +508,7 @@ At the present time we support one utility method.
508
508
509
509
.. code-block :: python
510
510
511
- if results.replies_full[' status' ] != getdns.GETDNS_RESPSTATUS_GOOD :
511
+ if results.replies_full[' status' ] != getdns.RESPSTATUS_GOOD :
512
512
print (getdns.get_errorstr_by_id(id = results.replies_full[' status' ])
513
513
sys.exit(1 )
514
514
0 commit comments