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.stringify({
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);
};
Direct PostgreSQL Function Calling
Gust also supports calling PostgreSQL stored functions directly via WebSocket JSON-RPC:
from blueshed.gust import Gust, web, PostgresRPC
from psycopg import AsyncConnection
async def main():
conn = await AsyncConnection.connect("postgresql://user:pass@localhost/mydb")
pg_rpc = PostgresRPC(conn)
web.ws_json_rpc('/api', handler=pg_rpc)
Gust(port=8080).run()
Call any PostgreSQL function using the same JSON-RPC protocol shown above. An authenticated variant (AuthPostgresRPC) is available for automatic user injection. See samples/postgres_rpc_demo/ for complete examples.
There are simple sample apps in src/tests.
Metadata
Release files for blueshed-gust 0.0.26
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| blueshed_gust-0.0.26.tar.gz | 15.4 kB | Without provenance | Details for blueshed_gust-0.0.26.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| blueshed_gust-0.0.26-py3-none-any.whl | Python 3 | none | any | Details for blueshed_gust-0.0.26-py3-none-any.whl |
Total release size: 32.8 kB
Release files / blueshed_gust-0.0.26.tar.gz
| Download URL | blueshed_gust-0.0.26.tar.gz |
|---|---|
| Size | 15.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f0349227b6f9e0772d5f4782ed8b402033ed6f6f75e2f25965135106fa8b4686
|
|
BLAKE2b-256 checksum How to use checksums |
230d9a121008b2e6d1eb1af08a48fe4519b462bdad4d786ca7260a82c521f29e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.13.3
|
Release files / blueshed_gust-0.0.26-py3-none-any.whl
| Download URL | blueshed_gust-0.0.26-py3-none-any.whl |
|---|---|
| Size | 17.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1107d9bf1e4af0a2c35486a53d9f25a6f660ddcd41a1fd3b5e611e38a9a1c49d
|
|
BLAKE2b-256 checksum How to use checksums |
1183c571a8d9c126c0d1dfccb34e3db589daf25e950c0dfcfc710fff04900f8c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.13.3
|
Security for blueshed-gust 0.0.26
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.