Skip to main content

Aiohttp transport for Spyne RPC library

Project description

Build status

About

Aiohttp transport for Spyne RPC library.

Requirements:

  • Python >= 3.7

  • Aiohttp >= 3.7.0

  • Spyne >= 2.13.16

Spyne alpha versions should also work.

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)

Testing and formatting

  1. pytest

  2. mypy -p aiohttp_spyne

  3. flake8

  4. black aiohttp_spyne/

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.1.0.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: aiohttp-spyne-1.1.0.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.4

File hashes

Hashes for aiohttp-spyne-1.1.0.tar.gz
Algorithm Hash digest
SHA256 8bb3a39ddc9c0458797caf37dec28bf440765c68b794945a8d0f02b199ae5def
MD5 bd6233f76184827ad2a80aac8605d163
BLAKE2b-256 da8fb9d01712f8fee5bccd58b6ce414892747be52a7d4d672a3efe2e2747f059

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: aiohttp_spyne-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.4

File hashes

Hashes for aiohttp_spyne-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 224a1464b1d5f24f7700e408c9fdfd5781ec0027d4d780f15ab747f1d4f77a01
MD5 92fefe0912dce76e45fdf367ce25f01f
BLAKE2b-256 7a3d7615a4ee580055788883eeeff6e39c3f461c378958639cb9f0d05a6e824c

See more details on using hashes here.

Provenance

Supported by

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