Add a little demo of a SPORE client to call a function of the demo program

This commit is contained in:
Christophe de Vienne 2012-09-23 16:17:28 +02:00
parent a02b367a90
commit 9d03f6f1f1

View File

@ -0,0 +1,18 @@
import spyre
import spyre.middleware
class CTypeHeader(spyre.middleware.Middleware):
def __call__(self, env):
env.setdefault('spore.headers', [])
env['spore.headers'].extend([
('Accept', 'application/json'),
('Content-Type', 'application/json')
])
demo = spyre.new_from_url('http://127.0.0.1:8080/ws/api.spore')
demo.enable(CTypeHeader)
demo.enable('format.Json')
print demo.helloworld().content