Changes between Version 24 and Version 25 of ProposedWikiStart


Ignore:
Timestamp:
02/11/2014 12:56:19 PM (8 months ago)
Author:
rwall
Comment:

Shorten the example

Legend:

Unmodified
Added
Removed
Modified
  • ProposedWikiStart

    v24 v25  
    258258    answers, authority, additional = result 
    259259    if answers: 
    260         print(','.join('{} IN {}'.format(a.name.name, a.payload) for a in answers)) 
    261  
    262 def printSummary(results): 
    263     statuses = zip(*results)[0] 
    264     print('{} responses to {} queries'.format(statuses.count(True), len(statuses))) 
     260        print(', '.join('{} IN {}'.format(a.name.name, a.payload) for a in answers)) 
    265261 
    266262def main(reactor, *ipAddresses): 
     
    271267        d.addCallback(printResult) 
    272268        pending.append(d) 
    273     return defer.DeferredList(pending, consumeErrors=True).addCallback(printSummary) 
     269    return defer.DeferredList(pending, consumeErrors=True) 
    274270 
    275271task.react(main, sys.argv[1:]) 
    276 }}} 
    277  
    278 {{{ 
    279 $ python reverse-lookup.py 1.2.3.4 2.3.4.5 3.4.5.6 4.5.6.7 
    280 RESULT: [('5.4.3.2.in-addr.arpa', <PTR name=ALyon-651-1-21-5.w2-3.abo.wanadoo.fr ttl=1>)] 
    281 RESULT: [('6.5.4.3.in-addr.arpa', <PTR name=n003-000-000-000.static.ge.com ttl=1>)] 
    282 2 responses to 4 queries 
    283272}}} 
    284273