Tag DNS Records with Source and Collection Mode
from datetime import datetime, timezone
import json
def dns_observation(name: str, record_type: str, value: str, source: str) -> dict[str, str]:
return {
"name": name,
"record_type": record_type,
"value": value,
"source": source,
"collection_mode": "current-authoritative-lookup",
"observed_at": datetime.now(timezone.utc).isoformat(),
}
records = [
dns_observation("www.example.org", "CNAME", "example-cdn.net.", "dig"),
dns_observation("example.org", "MX", "10 mail.example.org.", "dig"),
]
print(json.dumps(records, indent=2))