Python bindings for signald
Project description
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: registration
import asyncio
from aiosignald import SignaldAPI
import aiosignald.generated as api
class SignalClient(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)
async def main():
loop = asyncio.get_running_loop()
_, signald = await loop.create_unix_connection(
SignaldAPI, path=SIGNALD_SOCKET_PATH)
await signald.register(account="+XXXXXX")
# Some async code to get the SMS code
code = await user_input("Enter your sms code?")
await signald.verify(account="+XXXXXX", code=code)
# linking to an existing account is also possible
# uri = await signald.generate_linking_uri()
await signald.on_con_lost
# See https://signald.org/articles/protocol/ for more info about this
SIGNALD_SOCKET_PATH = "/var/run/signald/signald.sock"
asyncio.run(main())
Docs are available on readthedocs.
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
aiosignald-0.3.0a4.tar.gz
(30.2 kB
view hashes)
Built Distribution
Close
Hashes for aiosignald-0.3.0a4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d76a9a781e5c1bf029097a9d1cf69813691276e6c4bb8e7541043d795ea0f9fe |
|
MD5 | 315a47ceb9b138eebd1b68bca6231fed |
|
BLAKE2b-256 | d3c515ba94e88430892a16da5935fca7dea418ddf42f27d6f6acd7cfa0a45c44 |