Skip to main content
Donate to the Python Software Foundation or Purchase a PyCharm License to Benefit the PSF! Donate Now

A Python client for the Ejabberd XMLRPC API

Project description

Documentation Status CircleCI Build Status Coverage Status Code Quality Status Scrtinizer Status
PyPI Package latest release PyPI Package monthly downloads PyPI Wheel Supported versions Supported imlementations
  • Free software: MIT license


pip install pyejabberd


from pyejabberd import EjabberdAPIClient

# Create a client and authenticate with elevated user ''
client = EjabberdAPIClient(host='localhost', port=5222, username='bob', password='p@$$wd', user_domain='',

# Test the connection by sending an echo request to the server
sentence = 'some random data'
result = client.echo(sentence)
assert result == sentence

# Get a list of users that are on the server
registered_users = client.registered_users('')
# result is in the format [{'username': 'bob', ...}]

# Register a new user
client.register(user='alice', host='', password='@l1cepwd')

# Change a password
client.change_password(user='alice', host='', newpass='newpwd')

# Verify password
assert client.check_password_hash(user='bob', host='', password='newpwd') is True

# Set nickname
client.set_nickname(user='bob', host='', nickname='Bob the builder')

# Get muc rooms
muc_online_rooms = client.muc_online_rooms()
# result is in the format ['room1@conference', ...] where 'conference' is the muc service name

# Create a muc room
client.create_room(name='room1', service='conference', host='')

# Get room options
room_options = client.get_room_options(name='room1', service='conference')

# Set room option
from pyejabberd.muc.enums import MUCRoomOption
client.change_room_option(name='room1', service='conference', option=MUCRoomOption.public, value=False)
client.change_room_option(name='room1', service='conference', option=MUCRoomOption.members_only, value=True)

# Set room affiliation
from pyejabberd.muc.enums import Affiliation
client.set_room_affiliation(name='room1', service='conference', jid='', affiliation=Affiliation.member)

# Get room affiliations
affiliations = client.get_room_affiliations(name='room1', service='conference')

# Destroy a muc room
client.destroy_room(name='room1', service='conference', host='')

# Unregister a user
client.unregister(user='alice', host='')


To run the all tests run:


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
pyejabberd-0.2.6-py2.py3-none-any.whl (15.3 kB) Copy SHA256 hash SHA256 Wheel 2.7
pyejabberd-0.2.6.tar.gz (19.5 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page