diff options
author | Kali Kaneko (leap communications) <kali@leap.se> | 2016-03-31 20:51:47 -0400 |
---|---|---|
committer | Kali Kaneko (leap communications) <kali@leap.se> | 2016-03-31 20:51:47 -0400 |
commit | 39343f414617736831237cd1d417d1ba83c8268a (patch) | |
tree | 6204f5d99cd83e168267820299bfd6680d3bcfa6 /tasks.py | |
parent | 8e7a4c0b8bdbefdeb6db9660da97de5320899910 (diff) |
working ampoule task
Diffstat (limited to 'tasks.py')
-rw-r--r-- | tasks.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tasks.py b/tasks.py new file mode 100644 index 0000000..5079e4b --- /dev/null +++ b/tasks.py @@ -0,0 +1,21 @@ +from twisted.protocols import amp +from ampoule import child + + +def fib(n): + if n <= 2: + return 1 + else: + return fib(n-1) + fib(n-2) + + +class Fib(amp.Command): + response = [("fib", amp.Integer())] + + +class FibCalculator(child.AMPChild): + @Fib.responder + def fib(self): + print 'called responder, fib...' + n = 10 + return {"fib": fib(n)} |