Client-Server SDK for Matrix
Matrix Client SDK for Python
Matrix client-server SDK for Python 2.7 and 3.4+
We strongly recommend using the matrix-nio library rather than this sdk. It is both more featureful and more actively maintained.
This sdk is currently lightly maintained without any person ultimately responsible for the project. Pull-requests may be reviewed, but no new-features or bug-fixes are being actively developed. For more info or to volunteer to help, please see https://github.com/matrix-org/matrix-python-sdk/issues/279 or come chat in #matrix-python-sdk:matrix.org.
Install with pip from pypi. This will install all necessary dependencies as well.
pip install matrix_client
Install using setup.py in root project directory. This will also install all needed dependencies.
git clone https://github.com/matrix-org/matrix-python-sdk.git cd matrix-python-sdk python setup.py install
The SDK provides 2 layers of interaction. The low-level layer just wraps the raw HTTP API calls. The high-level layer wraps the low-level layer and provides an object model to perform actions on.
from matrix_client.client import MatrixClient client = MatrixClient("http://localhost:8008") # New user token = client.register_with_password(username="foobar", password="monkey") # Existing user token = client.login(username="foobar", password="monkey") room = client.create_room("my_room_alias") room.send_text("Hello!")
from matrix_client.api import MatrixHttpApi matrix = MatrixHttpApi("https://matrix.org", token="some_token") response = matrix.send_message("!roomid:matrix.org", "Hello!")
The SDK is split into two modules: api and client.
This contains the raw HTTP API calls and has minimal business logic. You can set the access token (token) to use for requests as well as set a custom transaction ID (txn_id) which will be incremented for each request.
This encapsulates the API module and provides object models such as Room.
A collection of samples are included, written in Python 3.
You can either install the SDK, or run the sample like this:
PYTHONPATH=. python samples/samplename.py
Building the Documentation
The documentation can be built by installing sphinx and sphinx_rtd_theme.
Simple run make inside docs which will list the avaliable output formats.
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size matrix_client-0.4.0-py2.py3-none-any.whl (43.5 kB)||File type Wheel||Python version py2.py3||Upload date||Hashes View|
|Filename, size matrix_client-0.4.0.tar.gz (49.0 kB)||File type Source||Python version None||Upload date||Hashes View|
Hashes for matrix_client-0.4.0-py2.py3-none-any.whl