Skip to main content

rocketchat_API

Python API wrapper for Rocket.Chat

Codacy Badge Test codecov PyPI

Installation

  • From pypi: pip3 install rocketchat_API
  • From GitHub: Clone our repository and python3 setup.py install

Requirements

Usage

from pprint import pprint
from rocketchat_API.rocketchat import RocketChat

proxy_dict = {
    "http"  : "http://127.0.0.1:3128",
    "https" : "https://127.0.0.1:3128",
}

rocket = RocketChat('user', 'pass', server_url='https://demo.rocket.chat', proxies=proxy_dict)
pprint(rocket.me().json())
pprint(rocket.channels_list().json())
pprint(rocket.chat_post_message('good news everyone!', channel='GENERAL', alias='Farnsworth').json())
pprint(rocket.channels_history('GENERAL', count=5).json())

note: every method returns a requests Response object.

Connection pooling

If you are going to make a couple of request, you can user connection pooling provided by requests. This will save significant time by avoiding re-negotiation of TLS (SSL) with the chat server on each call.

from requests import sessions
from pprint import pprint
from rocketchat_API.rocketchat import RocketChat

with sessions.Session() as session:
    rocket = RocketChat('user', 'pass', server_url='https://demo.rocket.chat', session=session)
    pprint(rocket.me().json())
    pprint(rocket.channels_list().json())
    pprint(rocket.chat_post_message('good news everyone!', channel='GENERAL', alias='Farnsworth').json())
    pprint(rocket.channels_history('GENERAL', count=5).json())

Using a token for authentication instead of user and password

from pprint import pprint
from rocketchat_API.rocketchat import RocketChat

rocket = RocketChat(user_id='WPXGmQ64S3BXdCRb6', auth_token='jvNyOYw2f0YKwtiFS06Fk21HBRBBuV7zI43HmkNzI_s', server_url='https://demo.rocket.chat')
pprint(rocket.me().json())

Method parameters

Only required parameters are explicit on the RocketChat class but you can still use all other parameters. For a detailed parameters list check the Rocket chat API

API coverage

Most of the API methods are already implemented. If you are interested in a specific call just open an issue or open a pull request.

Tests

We are actively testing :)

Tests run on a Rocket.Chat Docker container so install Docker and docker-compose.

  1. To start test server do docker-compose up and to take test server down docker-compose down
  2. To run the tests run pytest

Contributing

You can contribute by doing Pull Requests. (It may take a while to merge your code but if it's good it will be merged). Please, try to implement tests for all your code and use a PEP8 compliant code style.

Reporting bugs and asking for features is also contributing ;) Feel free to help us grow by registering issues.

We hang out here if you want to talk.

Supporters

JetBrains JetBrains supports this project by providing us with licenses for their fantastic products.

Metadata

Release files for rocketchat-API 1.34.0

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

Source distribution (sdist)

Source distribution for rocketchat-API 1.34.0
File Size Uploaded Provenance Actions
rocketchat_api-1.34.0.tar.gz 27.2 kB With provenance Details for rocketchat_api-1.34.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rocketchat-API 1.34.0
File Interpreter ABI Platform Actions
rocketchat_API-1.34.0-py3-none-any.whl Python 3 none any Details for rocketchat_API-1.34.0-py3-none-any.whl

Total release size: 49.7 kB

Release files / rocketchat_api-1.34.0.tar.gz

Download URL rocketchat_api-1.34.0.tar.gz
Size 27.2 kB
Tags Source
SHA-256 checksum
How to use checksums
9e50b1960f43278bed312b88ae0cee3515468fc55c8d66a7d047f156f757a127
BLAKE2b-256 checksum
How to use checksums
a2f9d6e75eb478d8e586607b0ea3b7e9cb4cd56fbba78494370de8231524b48b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 5, 2024.

Transparency log

Release files / rocketchat_API-1.34.0-py3-none-any.whl

Download URL rocketchat_API-1.34.0-py3-none-any.whl
Size 22.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7e201015fd3ec09440af2fa12fcdf8f947081866c780d980d6a76431da805546
BLAKE2b-256 checksum
How to use checksums
e357eabba1eef03c37648ce44a1b2f220132ff568a61b0da64048ea5ee9fb7d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 5, 2024.

Transparency log

Security for rocketchat-API 1.34.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for rocketchat_api-1.34.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 5, 2024.

Transparency log

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

1.34.0 This release

2 release files Full 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