Skip to content

getting record data to output as json #830

Answered by bwelling
junkb asked this question in Q&A
Discussion options

You must be logged in to vote

Your code would need to iterate the rdatasets in the node, and the individual records in each rdataset. This should be a reasonable starting point.

for (name, node) in zone.items():
    print(name)
    for rdset in node:
        type = rdset.rdtype
        print(f'{dns.rdatatype.to_text(rdset.rdtype)}')
        for rr in rdset:
            print(f'rr {rr}')
    print()

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@junkb
Comment options

Answer selected by junkb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants