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.24.tar.gz
(10.9 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.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85daf557ad92760652bf151f16ec32f302d3ddb2c9b473dc25e194f9c9d01c9d
|
|
| MD5 |
0e524fc63c395286b69e487d82b3acbf
|
|
| BLAKE2b-256 |
66b4cb663391cd2c096e00647420d03434ac47711e134d1d52a5b4a148faa937
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a110947d45ccc0e3ef08910f19567466d9b9d5c5fe0f83c7ad14b386d48de87
|
|
| MD5 |
3760b7c6028ee415457b554ac51f0ee8
|
|
| BLAKE2b-256 |
c5e454427581afcfdd0b7d2fe37c3deb495a958712a63855c03b0352512f09c4
|