Skip to main content

Aiohttp transport for Spyne RPC library

Project description

Build status

About

Aiohttp transport for Spyne RPC library.

Requirements:

  • Python >= 3.6

  • Aiohttp >= 3.0.0

  • Spyne >= 2.12.9

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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: aiohttp-spyne-1.0.1.tar.gz
  • Upload date:
  • Size: 5.6 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.1.tar.gz
Algorithm Hash digest
SHA256 e88fd03d1e38ef3b25370d78ea200161ace157b7e4c4e408237cf8301a6ab479
MD5 4cd863f76ae71324bb34d6a73b5cb29d
BLAKE2b-256 f112b2ce957ec86e15baeea4cf8de4d3d10f478d63f23a0b727a8f2bc2adba2f

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: aiohttp_spyne-1.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 40e9d6011a01bd4370f3a0126346a085ab40fbbaed2e66aaa959e76eaafe216d
MD5 c36bfa5e09ffe1c16d1426c6965e4a05
BLAKE2b-256 1ce622ad13309da7b84a6a04d178f9de0fa29ec561a23b4914602f2bafe4b1af

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