Skip to main content

Client-Server SDK for Matrix

Project description

Matrix Client SDK for Python

Latest Version

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

# 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.0.5.tar.gz (21.1 kB view details)

Uploaded Source

Built Distribution

matrix_client-0.0.5-py3.6.egg (37.2 kB view details)

Uploaded Source

File details

Details for the file matrix-client-0.0.5.tar.gz.

File metadata

File hashes

Hashes for matrix-client-0.0.5.tar.gz
Algorithm Hash digest
SHA256 a3fc8817c87f1a9bf81c3f3d2a3d020db7aed56c4207d076312ab0f3380c686f
MD5 245a1709c899c21ae61e6cf0323fde5a
BLAKE2b-256 da8b823c24ccc0f30d5b88c7f7d5b2453d84e3e46dd7f6e48e46baf6cf1656e6

See more details on using hashes here.

Provenance

File details

Details for the file matrix_client-0.0.5-py3.6.egg.

File metadata

File hashes

Hashes for matrix_client-0.0.5-py3.6.egg
Algorithm Hash digest
SHA256 65efa6f22710703f783372897141a8a25a63758d8f3f1cb47258d1c365c48b71
MD5 53a112127902fb5b69fe1a1090bfe505
BLAKE2b-256 baacab7a247778858744a09f58d5dabbf6fa34a0691e7910b7cbbe2ddfce7697

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