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.24.tar.gz (10.9 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.24-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: blueshed_gust-0.0.24.tar.gz
  • Upload date:
  • Size: 10.9 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.24.tar.gz
Algorithm Hash digest
SHA256 85daf557ad92760652bf151f16ec32f302d3ddb2c9b473dc25e194f9c9d01c9d
MD5 0e524fc63c395286b69e487d82b3acbf
BLAKE2b-256 66b4cb663391cd2c096e00647420d03434ac47711e134d1d52a5b4a148faa937

See more details on using hashes here.

File details

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

File metadata

  • Download URL: blueshed_gust-0.0.24-py3-none-any.whl
  • Upload date:
  • Size: 13.6 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.24-py3-none-any.whl
Algorithm Hash digest
SHA256 6a110947d45ccc0e3ef08910f19567466d9b9d5c5fe0f83c7ad14b386d48de87
MD5 3760b7c6028ee415457b554ac51f0ee8
BLAKE2b-256 c5e454427581afcfdd0b7d2fe37c3deb495a958712a63855c03b0352512f09c4

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