Add a little demo of a SPORE client to call a function of the demo program
This commit is contained in:
parent
a02b367a90
commit
9d03f6f1f1
18
examples/demo/sporeclient.py
Normal file
18
examples/demo/sporeclient.py
Normal 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
|
Loading…
Reference in New Issue
Block a user