Skip to main content

XMPP module for Python

Project description

xmppy

tag commit license

status status

The repository is no longer being developed

Python module for receiving and sending message using XMPP protocol.

Requires python >=3.8, <3.10

Attention: Module DO NOT provide any layers of encryption. You use it at your own risk.

Repos: GitHub GitLab


Table of Contents


Installation

From source

# using poetry
user@host:~$ poetry install 
# using pip
user@host:~$ pip install .

Using pip

user@host:~$ pip install xmppy

AUR (TODO)

user@host:~$ 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

user@host:~$ 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!

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

xmppy-0.2.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xmppy-0.2-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file xmppy-0.2.tar.gz.

File metadata

  • Download URL: xmppy-0.2.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.3 Linux/6.8.7-arch1-2

File hashes

Hashes for xmppy-0.2.tar.gz
Algorithm Hash digest
SHA256 7e58b054020d76ff11e7a14562382d216d73715a62aba3ab9b67c0d74a43d7a8
MD5 94f7acca08e1236601c0b1ca14ba474a
BLAKE2b-256 c6ccaddd04b459d4cebed215b0a6972c984f46889cfc4332f60358f38b657d0b

See more details on using hashes here.

File details

Details for the file xmppy-0.2-py3-none-any.whl.

File metadata

  • Download URL: xmppy-0.2-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.3 Linux/6.8.7-arch1-2

File hashes

Hashes for xmppy-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5628891235a2fa28463e1abbe67e88a85095a6304985712052c1c50e2e8654f7
MD5 84d9b03702d1fd599362a566d9aa98d1
BLAKE2b-256 c09574777e6df9ef202b959143ac21ddeab92a6181b4022bcee286e2e799c55d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page