Skip to main content

lite additions to tornado.

Project description

Gust

PyPI - Version

Gust is a wrapper of tornado. It allows for a hello world such as:

from blueshed.gust import Gust, web

@web.get('/(.*)')
def get(request):
    """just a get"""
    return 'hello, world'

def main():
    """seperate construction from run"""
    Gust().run()

if __name__ == '__main__':
    main()

Similarly, you can write:

@web.ws_json_rpc('/websocket')
def add(a:float, b:float) -> float:
    """simple addition"""
    return a + b

And use a javascript websocket client to call the function:

const ws = new WebSocket("ws://localhost:8080/websocket");
ws.onopen = function () {
  ws.send(
    JSON.stringigy({
      jsonrpc: "2.0",
      id: 1,
      method: "add",
      params: { a: 2.0, b: 2.0 }, // or [2.0, 2.0]
    }),
  );
};
ws.onmessage = function (evt) {
  const pre = document.createElement("pre");
  pre.textContent = evt.data;
  document.body.appendChild(pre);
};

There are simple sample apps in src/tests.

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

blueshed_gust-0.0.25.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

blueshed_gust-0.0.25-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

Details for the file blueshed_gust-0.0.25.tar.gz.

File metadata

  • Download URL: blueshed_gust-0.0.25.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.1

File hashes

Hashes for blueshed_gust-0.0.25.tar.gz
Algorithm Hash digest
SHA256 cfe1864dbd5300c5249a2d519b16ec5e52afc06a16ead9e8ad83267a48138a58
MD5 d69da60c34c67c811c811153ce1c7c1b
BLAKE2b-256 ef667949f2b39ba2303dc9b619f956b75ec5c775a1eac559d0e111f7b787e9c4

See more details on using hashes here.

File details

Details for the file blueshed_gust-0.0.25-py3-none-any.whl.

File metadata

  • Download URL: blueshed_gust-0.0.25-py3-none-any.whl
  • Upload date:
  • Size: 14.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.1

File hashes

Hashes for blueshed_gust-0.0.25-py3-none-any.whl
Algorithm Hash digest
SHA256 3edca262a02788f2717fbc7f22542774929fbb11db90f1745ab4743f05cd8690
MD5 a787211a5a93f75fc6b1fffdce0bc260
BLAKE2b-256 adeaba7d6b33f74b5171883174db430a3c5aee89b2d30529de46594176ff4603

See more details on using hashes here.

Supported by

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