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.
Metadata
Release files for Shimarin 0.3.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| shimarin-0.3.6.tar.gz | 20.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| shimarin-0.3.6-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 32.7 kB
Release files / shimarin-0.3.6.tar.gz
| Download URL | shimarin-0.3.6.tar.gz |
|---|---|
| Size | 20.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
74ef287450451a7f9eda236ec5d96b0d85d862ad7e541c8da6d014aa343446d5
|
|
BLAKE2b-256 checksum How to use checksums |
d394d074e3ca25abee9afc7e6803b9c8804162b00ccf73cbbf826bd715bee851
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / shimarin-0.3.6-py2.py3-none-any.whl
| Download URL | shimarin-0.3.6-py2.py3-none-any.whl |
|---|---|
| Size | 11.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
b014f939d2cd3e7bba6fcca3788dc123193040aa5a5356296a259e0e999d9659
|
|
BLAKE2b-256 checksum How to use checksums |
39523e8fc6ea90c0dad71363b4ac0f85224c484568953d614fd6e0dc7f030d8a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|