If I have a spyne application that inherits from spyne.Application
and am serving that through a spyne.WsgiApplication
object, how would I add custom HTTP endpoints to the WSGI server such as /
or /info
?
The basic structure mirrors the one found on spyne.io
class HelloWorldService(ServiceBase):
@srpc(Unicode, Integer, _returns=Iterable(Unicode))
def say_hello(name, times):
for i in range(times):
yield 'Hello, %s' % name
application = Application([HelloWorldService], # <--- spyne.Application
tns='spyne.examples.hello',
in_protocol=Soap11(validator='lxml'),
out_protocol=JsonDocument()
)
if __name__ == '__main__':
from wsgiref.simple_server import make_server
wsgi_app = WsgiApplication(application) # <--- spyne.WsgiApplication
server = make_server('0.0.0.0', 8000, wsgi_app)
server.serve_forever()