~ntt-pf-lab/nova/monkey_patch_notification

« back to all changes in this revision

Viewing changes to vendor/Twisted-10.0.0/doc/names/examples/gethostbyname.py

  • Committer: Jesse Andrews
  • Date: 2010-05-28 06:05:26 UTC
  • Revision ID: git-v1:bf6e6e718cdc7488e2da87b21e258ccc065fe499
initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
 
 
3
# Copyright (c) 2009 Twisted Matrix Laboratories.
 
4
# See LICENSE for details.
 
5
 
 
6
import sys
 
7
from twisted.names import client
 
8
from twisted.internet import reactor
 
9
 
 
10
def gotResult(result):
 
11
    print result
 
12
    reactor.stop()
 
13
 
 
14
def gotFailure(failure):
 
15
    failure.printTraceback()
 
16
    reactor.stop()
 
17
 
 
18
d = client.getHostByName(sys.argv[1])
 
19
d.addCallbacks(gotResult, gotFailure)
 
20
 
 
21
reactor.run()