lite additions to tornado.
Project description
Gust
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
Release history Release notifications | RSS feed
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.22.tar.gz
(10.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file blueshed_gust-0.0.22.tar.gz.
File metadata
- Download URL: blueshed_gust-0.0.22.tar.gz
- Upload date:
- Size: 10.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d6d023fdaeafbc29ac36d2a1bc47146b2838598033d2a6edea10065b43ce22b9
|
|
| MD5 |
da20ba6c38e9b4c353196958677da4bc
|
|
| BLAKE2b-256 |
3eeea9d1f55c0a38545fc73a6a04f837f05a3b7b519a761bd9b02728dad46b43
|
File details
Details for the file blueshed_gust-0.0.22-py3-none-any.whl.
File metadata
- Download URL: blueshed_gust-0.0.22-py3-none-any.whl
- Upload date:
- Size: 13.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05a53b7fef2ec92ccd78b0ecb55e7283090c3ba77a35d41c6bafe73a4de20ea9
|
|
| MD5 |
ee4a75accfa4904aa782eeadcb5bcb66
|
|
| BLAKE2b-256 |
d2373f98345820c1790981f7f95ff63188ca4d55653d960f605465b5749c0f15
|