skip to navigation
skip to content

Not Logged In

Flask-Spyne 0.1-dev

A Flask extension, provides support for Spyne that makes it easy to expose online services that have a well-defined API using multiple protocols and transports.

Latest Version: 0.2

Flask-Spyne is a Flask extension which provides Spyne (formerly known as soaplib) support. Inspired by unofficial Flask-Enterprise extension (a wrapper on top of outdated soaplib).

Installation

pip install flask-spyne

Please check list of additional requirements you might need to install.

Server example

from flask import Flask
from flask.ext.spyne import Spyne
from spyne.protocol.soap import Soap11
from spyne.model.primitive import Unicode, Integer
from spyne.model.complex import Iterable

app = Flask(__name__)
spyne = Spyne(app)

class SomeSoapService(spyne.service):
    __service_url_path__ = '/soap/someservice'
    __in_protocol__ = Soap11(validator='lxml')
    __out_protocol__ = Soap11()

    @spyne.srpc(Unicode, Integer, _returns=Iterable(Unicode))
    def echo(str, cnt):
        for i in range(cnt):
            yield str

if __name__ == '__main__':
    app.run(host = '127.0.0.1')

Client example

from suds.client import Client as SudsClient

url = 'http://127.0.0.1:5000/soap/someservice?wsdl'
client = SudsClient(url=url, cache=None)
r = client.service.echo(str='hello world', cnt=3)
print r
 
File Type Py Version Uploaded on Size
Flask-Spyne-0.1-dev.tar.gz (md5) Source 2014-05-13 3KB
  • Downloads (All Versions):
  • 31 downloads in the last day
  • 121 downloads in the last week
  • 433 downloads in the last month