asynchronous event-based communication between client and server
Project description
Shimarin
Asynchronous event-based communication between client and server.
How to use
Examples are in example folder
RESTful interface
In order to communicate, this lib uses REST requests. To fetch events, the client sends a GET request to the route /events?fetch=n, where fetch is the number of events to fetch. The response is a json array containing a number of events less than or equals the fetch number. For example, /events?fetch=5 fetch the first 5 events.
The callback route is defined by /callback and receives a POST request with a header "X-Identifier" containing the event uuid. The body of the request contains data to be used by a user-defined callback function.
You can also setup middlewares for data persistence. See the implementation for SQLite Persistent Middleware.
If you want to use the Flask plugin, just import ShimaApp. It is an instance of a Flask Blueprint so you can just register it in your Flask App.
Install
pip install Shimarin
of
pip install Shimarin[flask]
Known bugs
- Return type for event trigger is Any because when fetching events it returns
Event[Unknown]and I could not cast the return type of the callback function to the fetched event. You can always annotate the handler function to retuen the right type. Right now the return type for the Event is Any.
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
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 shimarin-0.3.6.tar.gz.
File metadata
- Download URL: shimarin-0.3.6.tar.gz
- Upload date:
- Size: 20.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74ef287450451a7f9eda236ec5d96b0d85d862ad7e541c8da6d014aa343446d5
|
|
| MD5 |
55a8714003535bb41609f49e4c095f09
|
|
| BLAKE2b-256 |
d394d074e3ca25abee9afc7e6803b9c8804162b00ccf73cbbf826bd715bee851
|
File details
Details for the file shimarin-0.3.6-py2.py3-none-any.whl.
File metadata
- Download URL: shimarin-0.3.6-py2.py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b014f939d2cd3e7bba6fcca3788dc123193040aa5a5356296a259e0e999d9659
|
|
| MD5 |
fb93fb03c43fd3d4553a6f60d2452c2c
|
|
| BLAKE2b-256 |
39523e8fc6ea90c0dad71363b4ac0f85224c484568953d614fd6e0dc7f030d8a
|