MCPcopy Create free account
hub / github.com/rthalley/dnspython / get_node

Method get_node

dns/zone.py:263–287  ·  view source on GitHub ↗

Get a node in the zone, possibly creating it. This method is like ``find_node()``, except it returns None instead of raising an exception if the node does not exist and creation has not been requested. *name*: the name of the node to find. The value may be a

(
        self, name: dns.name.Name | str, create: bool = False
    )

Source from the content-addressed store, hash-verified

261 return node
262
263 def get_node(
264 self, name: dns.name.Name | str, create: bool = False
265 ) -> dns.node.Node | None:
266 """Get a node in the zone, possibly creating it.
267
268 This method is like ``find_node()``, except it returns None instead
269 of raising an exception if the node does not exist and creation
270 has not been requested.
271
272 *name*: the name of the node to find.
273 The value may be a ``dns.name.Name`` or a ``str``. If absolute, the
274 name must be a subdomain of the zone's origin. If ``zone.relativize``
275 is ``True``, then the name will be relativized.
276
277 *create*, a ``bool``. If true, the node will be created if it does
278 not exist.
279
280 Returns a ``dns.node.Node`` or ``None``.
281 """
282
283 try:
284 node = self.find_node(name, create)
285 except KeyError:
286 node = None
287 return node
288
289 def delete_node(self, name: dns.name.Name | str) -> None:
290 """Delete the specified node if it exists.

Callers 12

delete_rdatasetMethod · 0.95
_txn_add_nsecFunction · 0.45
_sign_zone_nsecFunction · 0.45
_name_existsMethod · 0.45
_get_nodeMethod · 0.45
test_zone_rollbackFunction · 0.45
testDeleteRdataset2Method · 0.45
do_test_node_flagsFunction · 0.45
diff_zonesFunction · 0.45

Calls 1

find_nodeMethod · 0.95

Tested by 5

test_zone_rollbackFunction · 0.36
testDeleteRdataset2Method · 0.36
do_test_node_flagsFunction · 0.36