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.23.tar.gz
(10.8 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.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e41172d6dd9187d870a0165c1731fe8343fdd2f433a6cca2ffdcddcab3deeab8
|
|
| MD5 |
e92a9ca7df7f8faae68d8ce90cedb2fa
|
|
| BLAKE2b-256 |
4529aa5220adac451bf27e3f86dcacd8700033632a2aff419acaeea103a0322f
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1da1ccbef0c97496955226781ea71583a207705880c96b41ef58fe0723542d6
|
|
| MD5 |
6bb1cb0b41bc63329f9feada6e3e8dc0
|
|
| BLAKE2b-256 |
7742d0b00c23fd4e601511105a0bd0d398fdc12a42bf62901df0387ae0d40812
|