Skip to content
PySOA MVP
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE
README.md
blpop-rpush.gif
client.py
server.py
settings.py

README.md

PySOA Example

Requirements

Install

pip3 install pysoa

Usage

Shell A

python3 -m server -s settings

Shell B

python3 client.py

Under the hood

Start redis-cli monitor before running the server and the client to see the exchanged messages.

They both use RPUSH for sending the messages and BLPOP for reading them:

BLPOP/RPUSH example

Conformity

If you want to validate the request and the response, follow these steps:

  • Install Conformity: pip3 install conformity
  • Update server.py:
from conformity import fields

# ...

class SquareAction(Action):
    request_schema = fields.Dictionary({
        'number': fields.Float(),
    })

    response_schema = fields.Dictionary({
        'square': fields.Float(),
    })
    # ...

References

You can’t perform that action at this time.