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.23.tar.gz (10.8 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.23-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: blueshed_gust-0.0.23.tar.gz
  • Upload date:
  • Size: 10.8 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.23.tar.gz
Algorithm Hash digest
SHA256 e41172d6dd9187d870a0165c1731fe8343fdd2f433a6cca2ffdcddcab3deeab8
MD5 e92a9ca7df7f8faae68d8ce90cedb2fa
BLAKE2b-256 4529aa5220adac451bf27e3f86dcacd8700033632a2aff419acaeea103a0322f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: blueshed_gust-0.0.23-py3-none-any.whl
  • Upload date:
  • Size: 13.5 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.23-py3-none-any.whl
Algorithm Hash digest
SHA256 e1da1ccbef0c97496955226781ea71583a207705880c96b41ef58fe0723542d6
MD5 6bb1cb0b41bc63329f9feada6e3e8dc0
BLAKE2b-256 7742d0b00c23fd4e601511105a0bd0d398fdc12a42bf62901df0387ae0d40812

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