[atlas] Problems with DNS measurements and NSID
- Previous message (by thread): [atlas] Problems with DNS measurements and NSID
- Next message (by thread): [atlas] Problems with DNS measurements and NSID
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Daniel Quinn
dquinn at ripe.net
Tue May 20 17:47:26 CEST 2014
On Tue 20 May 2014 17:08:47 CEST, Klaus Darilion wrote: Hi Daniel! Hi! Actually I tried it today but failed obviously due to my lack of Python. It would be great if you could add an example to the README e.g. with full result parsing: * load the json file from disk * loop over every result (json list) * print some value The full documentation already has a few examples <https://atlas.ripe.net/docs/sagan/#examples> that should be enough to get you going (I’ve just added some more), but here’s a breakdown of what you’re wanting: |from ripe.atlas.sagan import Result my_results_file = "/path/to/file.txt" with open(my_results_file) as results: for result in results.readlines(): parsed_result = Result.get(result) print(parsed_result.origin) | Once you have a |parsed_result|, you have access to all of the properties of that result, which are defined in the full documentation <https://atlas.ripe.net/docs/sagan/#attributes-methods>. Why do I have to use the responses[0] object? Can there be multiple responses with different nsids? In some cases, DNS results /can/ contain multiple responses. In an effort to maintain consistency for all DNS results, we opted to treat all DNS results as if they contain a list of responses — even if that list is of only one response. This makes it easier to write scripts that make use of the object, since you always have a consistent data type in |parsed_result.responses|. I hope that helps! -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://lists.ripe.net/ripe/mail/archives/ripe-atlas/attachments/20140520/3a5a330b/attachment.html>
- Previous message (by thread): [atlas] Problems with DNS measurements and NSID
- Next message (by thread): [atlas] Problems with DNS measurements and NSID
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]