Skip to main content

Client-Server SDK for Matrix

Project description

Matrix Client SDK for Python

Latest Version Travis-CI Results coveralls.io Results

This is a Matrix client-server SDK for Python 2.7 and 3.4+

Community discussion on usage of this SDK and development of this SDK can be found at #matrix-python-sdk:matrix.org.

Documentation can be found at http://matrix-org.github.io/matrix-python-sdk/

Installation

Stable release

Install with pip from pypi. This will install all necessary dependencies as well.

pip install matrix_client

Development version

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

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")

# New user
token = client.register_with_password(username="foobar", password="monkey")

# Existing user
token = client.login_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.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

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.

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

matrix_client-0.3.2.tar.gz (38.9 kB view details)

Uploaded Source

Built Distribution

matrix_client-0.3.2-py2.py3-none-any.whl (28.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file matrix_client-0.3.2.tar.gz.

File metadata

File hashes

Hashes for matrix_client-0.3.2.tar.gz
Algorithm Hash digest
SHA256 dce3ccb8665df0d519f08e07a16e6d3f9fab3a947df4b7a7c4bb26573d68f2d5
MD5 e0231d84e7209a17581660c30f35d7a1
BLAKE2b-256 36ddb69819db7e01efb3487093e085b806184c013273741c8be9e4c7bd0df102

See more details on using hashes here.

Provenance

File details

Details for the file matrix_client-0.3.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for matrix_client-0.3.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 2855a2614a177db66f9bc3ba38cbd2876041456f663c334f72a160ab6bb11c49
MD5 0812b05268f3b0704c41be20713d5056
BLAKE2b-256 6b0b65dc841fd3d14e7ebc6081bbfce23365a6b2f68cc6ae2ae2d1d7d59570cd

See more details on using hashes here.

Provenance

Supported by

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