Skip to content
Python XMPP messenger
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples
xmppy
.gitignore
LICENSE
README.md
setup.py

README.md

xmppy

tag commit license

status status

Python module for receiving and sending message using XMPP protocol.

Repos: GitHub GitLab


Table of Contents


Installation

From source

python3 setup.py install

Depedencies:

  • sleekxmpp
  • python-gnupg

Using pip

pip install xmppy

or using .whl from releases:

pip install xmppy-XXX.whl

AUR (TODO)

makepkg xmppy

Usage

Sending and receiving messages

example 1

(using classmethod)

import xmppy.Messenger as xb
import subprocess as sp

def monitor():
	return "Example message"

def reply(msg):
	return sp.check_output(msg, shell=True).decode()

#send monitor() every 60 seconds and keep receiving reply()
Client = xb.Client.initialize("jabber_id@examp.le", "password",
				"send_to@examp.le", monitor, reply, freq=60)

example 1

example 2

(only sending messages)

#send one message (for looping add freq param)
Client = xb.Client.sendMessage("jabber_id@examp.le", "password",
						"send_to@examp.le", monitor)

example 3

(only receiving messages)

Client = xb.Client.receiveMessage("jabber_id@examp.le", "password", reply)

Data input

Instead od entering data as parameters xmppy.Client("jid","pass","recipient"...) you can use .ini file:

#example.ini
[configfile]
jid = jid@examp.le
password = qwerty123
# recipient input is optional.
# In order to use entry below you should mark recipient as None in Client constructor
# i.e. xmppy.Client("file", "example.ini", None, ...) Otherwise, this input will be ignored.
recipient = rece@examp.le

and change function call from .Client("jid@examp.le", "password", "recipient@examp.le", ...) to .Client("file", "<.ini file>", <None or recipient@examp.le>, ...). Feature works with all calls from examples (1,2,3).

Console script

xmppy -j <Jabber ID> -p <password> -t <recipient> -m <message>


Encryption

GPG

(in progress...)

Client = xb.Client.initialize("jabber_id@examp.le", "password",
				"send_to@examp.le", monitor, reply, freq=60, wait=True)
#temporarily doesn't support signing and receiving encrypted messages TODO!
Client.enableGPG("UID", "gnupghome_dir")

Client.run(wait=False)

OMEMO

TODO!

You can’t perform that action at this time.