minimal implementation of a serverless XMPP client
Project description
python-presence - a minimal implementation of a serverless XMPP client.
Installation
- Clone this repository
- Run
pip3 install .
Usage (example client)
There is a minimal python script called python-presence
for running a service:
usage: python-presence [-h] [-d] [-k] [-f] [-v]
python-presence
optional arguments:
-h, --help show this help message and exit
-d, --daemon run as daemon
-k, --kill kill running instance if any before start
-f, --force force start on bogus lockfile
-v, --verbose
Default client commands
The client currently supports the following built-in trigger commands/keywords:
Commmand | Description |
---|---|
echo |
echo message text |
help |
print a list of commands |
hello |
print a hello message |
vars |
print variables |
ls |
list contents of download directory |
Extending the client with custom commands
A simple application of client commands is remote query of system information.
import subprocess
commands = {
'df': ClientThread.make_command(
func=staticmethod(
lambda client, _: client.send_ascii(
subprocess.check_output("df -h", shell=True).decode('utf-8'))
),
helptext='show list of processes',
),
'ps': ClientThread.make_command(
func=staticmethod(
lambda client, _: client.send_ascii(
subprocess.check_output("ps aux", shell=True).decode('utf-8'))
),
helptext='show list of processes',
),
}
Dependencies
python3-daemon
python3-lockfile
python3-psutil
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
python-presence-0.1.3.tar.gz
(25.9 kB
view hashes)
Built Distribution
Close
Hashes for python_presence-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8298afaf0f271b2f6c4699a2e80e2919d977ae062724d13f9f377c880e7dad7b |
|
MD5 | 56e0e8bbe629fba170af456e2afbc15d |
|
BLAKE2b-256 | ac4e76ef5d8656f90308e1f6a175ab0367648e41dabdb2457e2a2ead30cf2a58 |