Line | |
---|
1 | #!/usr/bin/env python |
---|
2 | |
---|
3 | |
---|
4 | from foolscap import Tub, eventual |
---|
5 | from twisted.internet import reactor |
---|
6 | import sys |
---|
7 | import pprint |
---|
8 | |
---|
9 | def oops(f): |
---|
10 | print("ERROR") |
---|
11 | print(f) |
---|
12 | |
---|
13 | def fetch(furl): |
---|
14 | t = Tub() |
---|
15 | t.startService() |
---|
16 | d = t.getReference(furl) |
---|
17 | d.addCallback(lambda rref: rref.callRemote("get_averages")) |
---|
18 | d.addCallback(pprint.pprint) |
---|
19 | return d |
---|
20 | |
---|
21 | d = eventual.fireEventually(sys.argv[1]) |
---|
22 | d.addCallback(fetch) |
---|
23 | d.addErrback(oops) |
---|
24 | d.addBoth(lambda res: reactor.stop()) |
---|
25 | reactor.run() |
---|
Note: See
TracBrowser
for help on using the repository browser.