3 python backend
Thomas Renard edited this page 2022-04-11 19:49:46 +00:00

How to develop test and play with the python backend

Because the python backend works with asyncio it is possible to use it in python's interactive mode. You are able to checkup and test all functions in this environment with a running asyncio loop.

Here is a little description how to use it.

Preparation

python3 -m venv venv
. venv/bin/activate
pip install -r test-requirements.txt
cd python
python

create python/pyotherside.py

def send(*argv):
    for arg in argv:
        print(arg)

First start: login

CACHEDIR is e. eg. ~/.cache, SHAREDIR is mostly found at ~/.local/share

from bluepill.client import BluepillClientFactory
client = BluepillClientFactory().get_client()
client.login(username, password, matrixserverurl, nameofdevice)
# work now
client.close()
C-d

Connect

from bluepill.client import BluepillClientFactory
client = BluepillClientFactory().get_client()
client.connect()
# work now
client.close()
C-d