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
)
| 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. |