DNS toolkit for Python supporting almost all record types with high-level and low-level DNS operations
85
Implement helpers that convert DNS record text into RRsets, produce wire-format bytes, and read them back while keeping canonical record ordering. Use the DNS dependency's built-in parsing and serialization helpers rather than manual string handling.
@generates
from typing import List, Tuple
def build_rrset(name: str, ttl: int, rdclass: str, rdtype: str, records: List[str]) -> Tuple[List[str], bytes]:
"""
Build an RRset from textual RDATA strings for a single name/class/type.
Returns (normalized_records, wire_bytes) where normalized_records contains full record lines
with name, TTL, class, type, and RDATA values sorted in canonical order.
Uses the dependency's parsing and RRset helpers for construction and serialization.
"""
def parse_wire(name: str, rdclass: str, rdtype: str, wire: bytes) -> List[str]:
"""
Parse wire-format data for a single RRset into canonical textual RDATA strings.
Uses the dependency's wire-parsing helpers rather than manual decoding.
"""Provides DNS record parsing, RRset construction, and wire-format serialization utilities.
Install with Tessl CLI
npx tessl i tessl/pypi-dnspythondocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10