ALIOT-PY: The python implementation of the Aliot library!
What is Aliot?
Before everything else, aliot is a fancy websocket written in python that aims to facilitate iot focused exchanges between a server and a client
Installation
- create a python virtual environment
- run the command
py -m venv venv
- run the command
- add aliot in a folder in your project (replace $FOLDER in the command by the name of your folder)
- run the command
pip install ./$FOLDER
Creating my first Aliot program
- create an object ObjConnecte
Creating an endpoint (or, like we call it here, a protocol)
-
Create a function that takes some parameters
# my function will take money ($) and give cookies for every 2$ received def give_cookies_for_money(money: int): return {"cookies": money // 2}
-
Register your function as a protocol by decorating it with the
on_recvdecorator in your ObjConnecte that you created for your project and pass the id of your protocol in the argument of the decorator# here, I chose that my function will be protocol 34 @my_iot.on_recv(action_id=34) def give_cookies_for_money(money: int): return {"cookies": money // 2}
-
As of now, my function
give_cookies_for_moneydoesn't return anything to the server, if I want to send back my cookies, I have to ways:- use the function
my_iot.send()
@my_iot.on_recv(action_id=34) def give_cookies_for_money(money: int): my_iot.send({"cookies": money // 2})
- set the convenience parameter
send_resultto True in the decorator
@my_iot.on_recv(action_id=34, send_result=True) def give_cookies_for_money(money: int): return {"cookies": money // 2}
- You're all set! Now repeat and enjoy! 🎉
- use the function
Order of execution (once run() is called)
- obj.on_start()
- On receive:
- [ interceptor.intercept_recv() ]
- decoder.decode_event(event: dict) -> AliotEvent
- controller.handle_event(event: AliotEvent) -> None
- decoder.decode_data(data: dict) -> T
- On send:
- encoder.encode_data(data: Any) -> dict
- encode.encode_event()
- obj.__send_event() -> None
Metadata
Release files for aliot-py 1.0.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 | Provenance | Actions |
|---|---|---|---|---|
| aliot-py-1.0.6.tar.gz | 13.6 kB | Without provenance | Details for aliot-py-1.0.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aliot_py-1.0.6-py3-none-any.whl | Python 3 | none | any | Details for aliot_py-1.0.6-py3-none-any.whl |
Total release size: 29.5 kB
Release files / aliot-py-1.0.6.tar.gz
| Download URL | aliot-py-1.0.6.tar.gz |
|---|---|
| Size | 13.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f8a1e5308a0fb97b397e5c76dbacc8649d91ffeec5d6ac709d16a59fe5235a73
|
|
BLAKE2b-256 checksum How to use checksums |
7230600daa4cdde580c69e2824e93547aa2bce09ac3603ea770de1ae16003690
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.7
|
Release files / aliot_py-1.0.6-py3-none-any.whl
| Download URL | aliot_py-1.0.6-py3-none-any.whl |
|---|---|
| Size | 15.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5ed79282e28047ef41f5d84795bd4c6a2955d16600503ebdba8c15d0d002b631
|
|
BLAKE2b-256 checksum How to use checksums |
3cbc9cda9d462e392b497811aad56c2eaba4af90b3533240244ef7175120e67b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.7
|
Security for aliot-py 1.0.6
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.