tessl install tessl/pypi-dnspython@1.16.0DNS toolkit for Python supporting almost all record types with high-level and low-level DNS operations
Agent Success
Agent success rate when using this tile
85%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.37x
Baseline
Agent success rate without this tile
62%
Builds authenticated DNS UPDATE wire packets that include EDNS configuration.
example.com, addition [('www', 300, 'A', '192.0.2.10')] and deletion [], returns a wire message using the DNS UPDATE opcode whose zone section targets example.com. and whose update section adds an A record for www.example.com. with TTL 300. @testexample.com and deletion ["old.example.com."], returns an UPDATE message whose update section removes existing records for that name using the DNS delete semantics (class NONE, type ANY). @test203.0.113.5/24 are provided, the message includes a single OPT record reflecting the payload size and encoded option; the option is absent when none are provided. @testupdate-key.example.com., base64 secret, algorithm hmac-sha256, fudge 300), the resulting message includes a TSIG record that validates successfully against those inputs. @test@generates
from dataclasses import dataclass
from typing import List, Optional, Tuple, Union, Dict, Any
@dataclass
class RecordChange:
name: str
ttl: int
rtype: str
rdata: str
@dataclass
class EdnsOption:
code: int
value: Union[str, bytes]
@dataclass
class TsigCredentials:
name: str
secret_base64: str
algorithm: str = "hmac-sha256"
fudge: int = 300
def compose_update(
zone: str,
additions: List[RecordChange],
deletions: List[str],
edns_payload: Optional[int] = None,
edns_options: Optional[List[EdnsOption]] = None,
tsig: Optional[TsigCredentials] = None,
message_id: Optional[int] = None,
) -> Tuple[bytes, Dict[str, Any]]:
"""
Builds a DNS UPDATE message that applies the requested record changes,
optionally sets EDNS payload size and options, optionally signs with TSIG,
and returns the wire bytes along with basic metadata derived from the message,
including the id, opcode name, and section counts.
"""Provides DNS message builders, EDNS option helpers, and TSIG signing utilities.