[tor-commits] [ooni-probe/master] Add example usage of DNS Test Template

art at torproject.org art at torproject.org
Tue Nov 20 18:59:13 UTC 2012


commit 3e364fa31d7659692ed3c6a2c4bd3387a336524e
Author: Arturo Filastò <art at fuffa.org>
Date:   Tue Nov 20 19:58:36 2012 +0100

    Add example usage of DNS Test Template
---
 nettests/examples/example_dnst.py |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/nettests/examples/example_dnst.py b/nettests/examples/example_dnst.py
new file mode 100644
index 0000000..b06e9af
--- /dev/null
+++ b/nettests/examples/example_dnst.py
@@ -0,0 +1,11 @@
+from ooni.templates.dnst import DNSTest
+
+class ExampleDNSTest(DNSTest):
+    def test_a_lookup(self):
+        def gotResult(result):
+            # Result is an array containing all the A record lookup results
+            print result
+
+        d = self.performALookup('torproject.org', ('8.8.8.8', 53))
+        d.addCallback(gotResult)
+        return d



More information about the tor-commits mailing list