Skip to main content

Aiohttp transport for Spyne RPC library

Project description

Build status Code Health

About

Aiohttp transport for Spyne RPC library.

Requirements:

  • Python >= 3.6

  • Aiohttp >= 3.0.0

  • Spyne >= 2.12.7

Installation

Just run pip install aiohttp-spyne :)

Examples

  • Test server: python -m examples.hello_world

  • Threaded test server: python -m examples.hello_world_threads

  • Test client: python -m examples.test_client

Usage

First, initialize your spyne application as normal. Here’s an example for a simple SOAP service (See examples for a more complete service setup).

spyne_app = spyne.Application(
    [HelloWorldService],
    tns='aiohttp_spyne.examples.hello',
    in_protocol=Soap11(validator='lxml'),
    out_protocol=Soap11())

Next, wrap your Spyne application with AIOSpyne. Note that you can run your application entrypoints in a thread by setting the threads parameter. If you want to keep your entrypoints running in the same thread as the main application, just leave this None. If you DO run your entrypoints in threads, be aware that some signals sent by spyne will also be run in threads, and be extra careful of using your main loop!

handler = AIOSpyne(spyne_app, threads=25)

Lastly, make an aiohttp application as usual, and just bind GET and POST entrypoints from AIOSpyne to wherever. Note that both paths need to be the same.

With GET, if the request address ends ?wsdl or .wsdl, a WSDL schema is returned in a response. Otherwise requests are redirected to spynes RPC handler.

app = web.Application()
app.router.add_get('/{tail:.*}', handler.get)
app.router.add_post('/{tail:.*}', handler.post)
web.run_app(app, port=8080)

Tests

Run pytest. Make sure requirements are installed!

To check for PEP8 problems, run flake8.

License

LGPL-2.1 – Please see LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiohttp-spyne-1.0.0.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

aiohttp_spyne-1.0.0-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

Details for the file aiohttp-spyne-1.0.0.tar.gz.

File metadata

  • Download URL: aiohttp-spyne-1.0.0.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for aiohttp-spyne-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ee157c677b01f8320703184088fdb388f761c53440edffcfc79aa213ff6270e6
MD5 3d2166ae517ba271448766cb10336bb2
BLAKE2b-256 f37ed78b3010797a4a9110ab54b4c78917f3d28e985a4c92bd43effc2a741e88

See more details on using hashes here.

File details

Details for the file aiohttp_spyne-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: aiohttp_spyne-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 15.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for aiohttp_spyne-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 46f29e5a3352a976a379b9ee365ff191ffbacd3074a1f90156ac062a70d4168c
MD5 faa5303b7521dc031179b7ac05ac113e
BLAKE2b-256 91b399eeed03bbc173a110b76fe6e72a3adade17da603757a7f5adda478cf0a1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page