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_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-py3 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| flask-spyne-py3-1.0.0.tar.gz | 4.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| flask_spyne_py3-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.4 kB
Release files / flask-spyne-py3-1.0.0.tar.gz
| Download URL | flask-spyne-py3-1.0.0.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a03a42243c2e0c286ac6370e207911bbf747671385ad02559d717d08608314e5
|
|
BLAKE2b-256 checksum How to use checksums |
37f88f62ab451cb0d3480ba99e1819c919a7ceeaa12737c8477043cb1b85f86e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.2
|
Release files / flask_spyne_py3-1.0.0-py3-none-any.whl
| Download URL | flask_spyne_py3-1.0.0-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a7e701943bf007c6766f5d073f946a4e722be24ab94cb2577aa4d0254be93d81
|
|
BLAKE2b-256 checksum How to use checksums |
eb07197b15d71039afabb8caed731527976f7c47b24aeee0ad6d1bd72ed1daa6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.2
|