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

Uploaded Source

Built Distribution

blueshed_gust-0.0.21-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: blueshed_gust-0.0.21.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.1

File hashes

Hashes for blueshed_gust-0.0.21.tar.gz
Algorithm Hash digest
SHA256 64b523cbf59d949f07b440ef5f4a2fbbb86fba0fb0c40264176b02e24e06cff7
MD5 75712175ddd773b4828f12565f70b3b3
BLAKE2b-256 2db55bd662c0ce3f0b76e01f7bf0fb46e4dacb2b236ff6228c6f90b7ec895e9c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for blueshed_gust-0.0.21-py3-none-any.whl
Algorithm Hash digest
SHA256 066c36ab3a2992a1ede81330373a84a46528232c42f9b1719df2774867096f38
MD5 1b88bcd9203410874578a4428d817722
BLAKE2b-256 cbd12d18952408c136aba1180341f238ed20d4a11ff8ef93a4436c7b5ff5cb0d

See more details on using hashes here.

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