Search code examples
pythonspyne

Attach a custom view to spyne


I am using Spyne to provide SOAP interface to my backend, but a need one or more custom views accessible on certain URLS. For example to show some statistics in HTML.

How do i do that?


Solution

  • Please have a look at the multiple protocols example here: https://github.com/arskom/spyne/tree/master/examples/multiple_protocols

    If you want to return raw data via Http, you must set your output protocol to HttpRpc, your output type in your service to ByteArray or String and ctx.transport.mime_type to whatever type you're returning