Signald python bindings
Interact with the signal messaging network in python with sweet, sweet autocompletion.
Most of the code is generated by the generate.py script that
uses the schema available at https://signald.org/protocol.json.
No 3rd party dep, just the python standard lib.
Install
pip install aiosignald
Have signald running. See their docs about it.
Issue tracker: https://todo.sr.ht/~nicoco/aiosignald
Part of the slidge project (but can be used independently)
Usage
Example: echo bot
import asyncio
from aiosignald import SignaldAPI
import aiosignald.generated as api
class EchoBot(SignaldAPI):
async def handle_IncomingMessage(self, msg: api.IncomingMessagev1, _payload):
# hook to the incoming event by naming you function handle_EventName
# most stuff comes through an IncomingMessage anyway
print("Received: ", msg)
if (data_msg := msg.data_message) and (body := data_msg.body):
await self.send(
username=PHONE_NUMBER,
recipientAddress=msg.source,
messageBody=body
)
async def main():
loop = asyncio.get_running_loop()
_, signald = await loop.create_unix_connection(
EchoBot, path=SIGNALD_SOCKET_PATH)
if ACCOUNT_TYPE == "primary":
await signald.register(account=PHONE_NUMBER)
# Some async code to get the SMS code
code = await user_input("Enter your sms code?")
await signald.verify(account=PHONE_NUMBER, code=code)
else:
# linking to an existing account is also possible
resp = await signald.generate_linking_uri()
print("Make this a QR code and scan it on your primary signal device:", resp.uri)
await signald.finish_link(device_name="friendly-device-name", session_id=resp.session_id)
await signald.on_con_lost
# See https://signald.org/articles/protocol/ for more info about this
SIGNALD_SOCKET_PATH = "/var/run/signald/signald.sock"
PHONE_NUMBER = "+XXXXXX"
ACCOUNT_TYPE = "primary"
asyncio.run(main())
Docs are available on readthedocs.
Metadata
Release files for aiosignald 0.3.7
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 |
|---|---|---|---|---|
| aiosignald-0.3.7.tar.gz | 30.8 kB | Without provenance | Details for aiosignald-0.3.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aiosignald-0.3.7-py3-none-any.whl | Python 3 | none | any | Details for aiosignald-0.3.7-py3-none-any.whl |
Total release size: 62.2 kB
Release files / aiosignald-0.3.7.tar.gz
| Download URL | aiosignald-0.3.7.tar.gz |
|---|---|
| Size | 30.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e92de90b57cc3be70f388b013a310ec64bfc31a58590746582f8f62baffb24f7
|
|
BLAKE2b-256 checksum How to use checksums |
98870c9f9ad9aa08e99212eec853ec98b372bcef0691ec30de6771cefc07354e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.11.3 Linux/6.1.24-0-lts
|
Release files / aiosignald-0.3.7-py3-none-any.whl
| Download URL | aiosignald-0.3.7-py3-none-any.whl |
|---|---|
| Size | 31.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ba7ebb4eb291666da4d5d22039c4ae1d652d9da7561a221581348c4e1ad64499
|
|
BLAKE2b-256 checksum How to use checksums |
d282c62a90bd5ed9ea0230690a1c6f7f8204ef0420f45c4ceb4c1a0e09731b4e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.11.3 Linux/6.1.24-0-lts
|
Security for aiosignald 0.3.7
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.