Skip to main content

nio

Build Status codecov license Documentation Status #nio

nio is a multilayered matrix client library. The underlying base layer doesn't do any IO on its own. On top of the base layer, a no-IO HTTP client implementation exists, as well as a full fledged batteries included asyncio layer using aiohttp.

Documentation

The full API documentation for nio can be found at https://matrix-nio.readthedocs.io

Installation

To install nio, simply use pip:

$ pip install matrix-nio

Note that this installs nio without end-to-end encryption support. For e2ee support python-olm is needed which requires a the libolm C library.

After libolm has been installed the e2ee enabled version of nio can be installed using pip:

$ pip install "matrix-nio[e2e]"

Usage

Unless special requirements disallow the usage of asyncio, by far the easiest way to use nio is using the asyncio layer:

import asyncio
from nio import (AsyncClient, RoomMessageText)

async def message_cb(room, event):
    print(
        "Message received for room {} | {}: {}".format(
            room.display_name, room.user_name(event.sender), event.body
        )
    )

async def main():
    client = AsyncClient("https://example.org", "@alice:example.org")
    client.add_event_callback(message_cb, RoomMessageText)

    await client.login("hunter1")
    await client.sync_forever(timeout=30000)

asyncio.get_event_loop().run_until_complete(main())

Please do note that this example requires python 3.5+ for the async/await syntax. nio on the other hand works with older python versions as well.

Metadata

Release files for matrix-nio 0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for matrix-nio 0.5
File Size Uploaded Provenance Actions
matrix-nio-0.5.tar.gz 209.1 kB Without provenance Details for matrix-nio-0.5.tar.gz

Release files / matrix-nio-0.5.tar.gz

Download URL matrix-nio-0.5.tar.gz
Size 209.1 kB
Tags Source
SHA-256 checksum
How to use checksums
657cc79a4ce2774dc4b72e25c94cae0696e82c4f35a60ca5cbb557734b6504fa
BLAKE2b-256 checksum
How to use checksums
0d27a9cd1afd49d3166098cc0f96c4c03ca53e82a20dfebef4c572f2c88d6c85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.4

Security for matrix-nio 0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.5 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page