docs |
|
|---|---|
tests |
|
package |
|
compatibility |
A Python client for the Ejabberd XMLRPC API
Free software: MIT license
Installation
pip install pyejabberd
Contributors
A big thanks to the contributors:
Jim Cortez: https://github.com/jimcortez
Marek Kuziel: https://github.com/encodeltd
Documentation
Usage
from pyejabberd import EjabberdAPIClient
# Create a client and authenticate with elevated user 'bob@example.com'
client = EjabberdAPIClient(host='localhost', port=5222, username='bob', password='p@$$wd', user_domain='example.com',
protocol='https')
# 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('example.com')
# result is in the format [{'username': 'bob', ...}]
# Register a new user
client.register(user='alice', host='example.com', password='@l1cepwd')
# Change a password
client.change_password(user='alice', host='example.com', newpass='newpwd')
# Verify password
assert client.check_password_hash(user='bob', host='example.com', password='newpwd') is True
# Set nickname
client.set_nickname(user='bob', host='example.com', nickname='Bob the builder')
# Get Bob's contacts
client.get_roster(user='bob', host='example.com')
# Add Alice to Bob's contact group Friends
client.add_rosteritem(localuser='bob', localserver='example.com', user='alice', server='example.com', nick='Alice from Wonderland', group='Friends', subs='both')
# Delete Alice from Bob's contacts
client.delete_rosteritem(localuser='bob', localserver='example.com', user='alice', server='example.com')
# Get list of *all* connected users
client.connected_users()
# Get list of *all* connected users and information about their sessions
client.connected_users_info()
# Get number of connected users
client.connected_users_number()
# Get information for all sessions for a user
client.user_sessions_info(user="jim", host="example.com"):
# 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='example.com')
# 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='alice@example.com', 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='example.com')
# Unregister a user
client.unregister(user='alice', host='example.com')
Development
To run the all tests run:
tox
Changelog
0.2.11 (2016-03-09)
Updated “enum34” version requirement
0.2.10 (2015-09-16)
Added API: add_rosteritem
Added API: delete_rosteritem
Added API: get_roster
0.2.9 (2015-08-12)
Bugfix and small improvements
0.2.8 (2015-08-03)
Added testing against Ejabberd 15.07
0.2.7 (2015-07-28)
Added API: connected_users
Added API: connected_users_info
Added API: connected_users_number
Added API: user_sessions_info
0.2.6 (2015-07-14)
Added API: set_room_affiliation
Added API: get_room_affiliations
0.2.5 (2015-07-07)
Python 2/3 compatibility
Fixed failing build
0.2.4 (2015-07-06)
Made constructor more strict (no more kwargs)
Added optional function to create a client instance from a service url, compliant with the ‘12factor app’ idea
0.2.3 (2015-06-18)
Improved test suite
Made some enums more explicit
Aligned MUC room options with currently supported options in Ejabberd, build from master branch
0.2.2 (2015-05-25)
Cleanup and more tests
0.2.1 (2015-05-25)
Refactored method validator/serializer system
0.2.0 (2015-05-20)
Big refactor, interface changed to better match the ejabberdctl interface.
0.1.2 (2015-05-16)
Fixed build scripts.
0.1.1 (2015-05-16)
Some bugfixes.
0.1.0 (2015-05-16)
First release on PyPI.
Metadata
Release files for pyejabberd 0.2.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pyejabberd-0.2.11.tar.gz | 24.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyejabberd-0.2.11-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 44.0 kB
Release files / pyejabberd-0.2.11.tar.gz
| Download URL | pyejabberd-0.2.11.tar.gz |
|---|---|
| Size | 24.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ced8efc9bf06b3885fc61f4ecbddcfc78a5387c5dceca70fda52e9a9edb63885
|
|
BLAKE2b-256 checksum How to use checksums |
8570fd2ce96adb3da65e7e40a432df3216d10a976eb4114df4e3d0b025bc1278
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / pyejabberd-0.2.11-py2.py3-none-any.whl
| Download URL | pyejabberd-0.2.11-py2.py3-none-any.whl |
|---|---|
| Size | 19.5 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
58629f95c51ae879274ddeb8b5114b5f6350470237e2dce2c0f330252f04f17e
|
|
BLAKE2b-256 checksum How to use checksums |
15f4658ade66dbaf4db6484ba81f6c1015b6ff653debcee3310c52e3d0a17641
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for pyejabberd 0.2.11
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.