Client-Server SDK for Matrix
Project description
Matrix Client SDK for Python
This is a Matrix client-server SDK for Python 2.7 and 3.4+
Usage
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.
Client:
from matrix_client.client import MatrixClient
client = MatrixClient("http://localhost:8008")
token = client.register_with_password(username="foobar", password="monkey")
room = client.create_room("my_room_alias")
room.send_text("Hello!")
API:
from matrix_client.api import MatrixHttpApi
matrix = MatrixHttpApi("https://matrix.org", token="some_token")
response = matrix.initial_sync()
response = matrix.send_message("!roomid:matrix.org", "Hello!")
Structure
The SDK is split into two modules: api and client.
API
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.
Client
This encapsulates the API module and provides object models such as Room.
Samples
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file matrix-client-0.0.4.tar.gz
.
File metadata
- Download URL: matrix-client-0.0.4.tar.gz
- Upload date:
- Size: 20.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2125b0167ec241e6e9f6e76791dd3d5c5995f8900de80f663b13819c39f786e8 |
|
MD5 | a2658357780a54e8d487e82ae330891b |
|
BLAKE2b-256 | 6d8194703a0e9f6d830795946aedd359beecb1fe07122a7d1e69fe6b9ec1ef73 |