Created
May 12, 2014 20:29
-
-
Save laser/5ad41bead75789dbd112 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import barrister | |
trans = barrister.HttpTransport("http://localhost:3000/v1/todos") | |
client = barrister.Client(trans) | |
batch = client.start_batch() | |
batch.TodoManager.createTodo({ "title" : "Call Mom", "completed" : False }) | |
batch.TodoManager.createTodo({ "title" : "Call Dad", "completed" : False }) | |
batch.TodoManager.createTodo({ "title" : "Wash car", "completed" : False }) | |
batch.TodoManager.createTodo({ "title" : "Eat Ham", "completed" : False }) | |
results = batch.send() | |
for res in results: | |
# either res.error or res.result will be set | |
if res.error: | |
# res.error is a barrister.RpcException, so you can raise it if desired | |
print "err.code=%d" % res.error.code | |
else: | |
# result from a successful call | |
print res.result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment