Giter Site home page Giter Site logo

matrix-python-sdk's Introduction

Matrix Client SDK for Python

Latest Version

Travis-CI Results

coveralls.io Results

Documentation

Matrix client-server SDK for Python 2.7 and 3.4+

Project Status

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 matrix-org#279 or come chat in #matrix-python-sdk:matrix.org.

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(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.

matrix-python-sdk's People

Contributors

half-shot avatar non-jedi avatar zil0 avatar kegsay avatar galpressman avatar pik avatar oddvar avatar delijati avatar erikjohnston avatar dovf avatar severen avatar cadair avatar sim6 avatar rlp10 avatar sblondon avatar neilisfragile avatar turt2live avatar enckse avatar androbin avatar wolfecub avatar jfrederickson avatar anewusername avatar w1r0x avatar illicitonion avatar xsteadfastx avatar ara4n avatar croydon avatar lordievader avatar psaavedra avatar sherifeldeeb avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.