Skip to main content

Flask-Spyne

Flask-Spyne is a Flask extension which provides Spyne (formerly known as soaplib) support. Includes SOAP, WSDL, JSON, XML, YAML and other transports and protocols. 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

WS-Security

Starting from v0.2 flask-spyne supports basics of WS-Security for SOAP services.

Specify __wsse_conf__ dict with following fields:

username (str, required)
password (str, required)
password-digest (bool, optional)
nonce-freshness-time (int, optional)
reject-empty-nonce-creation (bool, optional)
reject-stale-tokens (bool, optional)
reject-expiry-limit (int, optional)

See server_auth.py/client_auth.py in examples for more details.

Written by Robert Ayrapetyan (robert.ayrapetyan@gmail.com).

No copyright. This work is dedicated to the public domain. For full details, see https://creativecommons.org/publicdomain/zero/1.0/

The third-party libraries have their own licenses, as detailed in their source files.

Metadata

Release files for Flask-Spyne 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Flask-Spyne 0.3.1
File Size Uploaded
Flask-Spyne-0.3.1.tar.gz 4.0 kB Details

Release files / Flask-Spyne-0.3.1.tar.gz

Download URL Flask-Spyne-0.3.1.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2043e8a6406f2a60fb8bb54639b44fcb4c5a46db4a53c4aa3dfdd84d8d6facc0
BLAKE2b-256 checksum
How to use checksums
0aa2436b5c7d7d6916b4b881f788f2b5f9620d82a7d90eb2004a244f6e2f23c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.3.1 This release

1 release file

0.2

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page