Sagan: 'Response' object has no attribute 'edns0'
Hi all, I'm trying to do some basic DNS UDM result parsing using Sagan. I'd like to have an easy way to extract the NSID. I followed the instruction found here: https://www.ripe.net/ripe/mail/archives/ripe-atlas/2014-May/001475.html 'from ripe.atlas.sagan import Result result = Result("your-JSON-result-blob-here") print(result.responses[0].edns0.options[0].nsid)' That didn't work, as I get: AttributeError: 'Result' object has no attribute 'responses' So I figured I need to use a DnsResult, instead. I then have the following Python code: from ripe.atlas.sagan import DnsResult import json url = "https://atlas.ripe.net/api/v1/measurement-latest/1873691/" results = json.load(urllib.urlopen(url)) for probe in results: sagan_result = DnsResult(results[probe][0]) print(sagan_result.responses[0].edns0.options[0].nsid) This gives me: print(sagan_result.responses[0].edns0.options[0].nsid) AttributeError: 'Response' object has no attribute 'edns0' After some digging through the Sagan documentation, I found out that the way to do this should be: print(sagan_result.responses[0].abuf.edns0.options[0].nsid) This might be of help to others. ~paul
participants (1)
-
Paul Vlaar