This archive is retained to ensure existing URLs remain functional. It will not contain any emails sent to this mailing list after July 1, 2024. For all messages, including those sent before and after this date, please visit the new location of the archive at https://mailman.ripe.net/archives/list/ripe-atlas@ripe.net/
[atlas] Problems with DNS measurements and NSID
- Previous message (by thread): [atlas] Problems with DNS measurements and NSID
- Next message (by thread): [atlas] NTT Communications (US, Miami) has joined RIPE Atlas anchors
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Daniel Quinn
dquinn at ripe.net
Wed May 21 12:12:09 CEST 2014
On 21/05/14 10:07, Klaus Darilion wrote: Thanks. Meanwhile I managed to iterate over the JSON list and print the nsid: … But the problem is if there was an error during the measurement (eg timeout), then my script terminates: … What is the suggested way to find out if a result is valid and exists? First of all, i should say thanks for working with us on this. The trouble with a parsing library is that it’s supposed to be able to handle all of the edge cases, but finding them independently is quite difficult. When you post examples to the list of result blobs that act in unexpected ways, this really helps in polishing the parser and making it more intuitive. Given that, and other comments from John regarding error handling for DNS results, I’ve added a little more code to better handle errors, so if you update Sagan to 0.1.12 (or just |git pull|), and re-run your code you’ll find that |result.is_error| is now set to |True| in your case. Additionally, if you pass |on_error=Result.ERROR_FAIL| to the parsing argument, it’ll explode with a |ResultParseError| which you can handle any way you please. So given your example, you could do something like: | result = DnsResult(d) if not result.is_error: # Do stuff | However, there’s likely cases where you might see results that /aren’t/ errors, but still don’t have any responses, or where |edns0.options| is an empty list. Unfortunately, you have to write your code to account for these, since they’re perfectly valid parsings: | result = DnsResult(d) if not result.is_error: for response in responses: if response.edns0: for option in response.edns0.options: print(option.nsid) | Note that I’m not really checking that much here, just looping over (potentially empty) lists. This keeps your code free of checks, and will make sure that it accounts for cases where the number of responses is > 1 or the number of edns0 options is > 1. But please, if you find another result blob that isn’t performing the way you’d expect, please feel free to post it here or send it to atlas-bugs at ripe.net so we can look into it and make sure that Sagan has complete coverage. -------------- next part -------------- An HTML attachment was scrubbed... URL: </ripe/mail/archives/ripe-atlas/attachments/20140521/b62c58af/attachment.html>
- Previous message (by thread): [atlas] Problems with DNS measurements and NSID
- Next message (by thread): [atlas] NTT Communications (US, Miami) has joined RIPE Atlas anchors
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]