GithubHelp home page GithubHelp logo

juergenbs / rocket-python Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pipoline/rocket-python

0.0 2.0 0.0 133 KB

RocketChat API Implemented in Python

Home Page: http://rocket-python.readthedocs.io

License: MIT License

Makefile 0.37% Python 99.63%

rocket-python's Introduction

RocketChat API

Python API wrapper for the Rocket chat API

Documentation

Travis (.org) PyPI - Downloads PyPI Codecov

Install

pip install rocket-python

Usage

Initialize the client with a username and password or token and user_id. This user must have Admin privs:

from rocketchat.api import RocketChatAPI

api = RocketChatAPI(settings={'username': 'someuser', 'password': 'somepassword',
                              'domain': 'https://myrockethchatdomain.com'})
# or
api = RocketChatAPI(settings={'token': 'sometoken', 'user_id': 'someuserid',
                              'domain': 'https://myrockethchatdomain.com'})
Available Calls
api.send_message('message', 'room_id')

api.get_private_rooms()

api.get_private_room_history('room_id', oldest=date)

api.get_public_rooms()

api.get_room_info('room_id')

api.get_private_room_info('room_id')

api.get_room_history('room_id')

api.create_public_room('room_name', 
                        members=[], 
                        read_only=False)

api.delete_public_room('room_id')

api.get_my_info()

api.get_users()

api.get_user_info('user_id')

api.create_user('email', 
                'name', 
                'password', 
                'username', 
                 active=True, 
                 roles=['user'], 
                 join_default_channels=True, 
                 require_password_change=False, 
                 send_welcome_email=False, 
                 verified=False, 
                 customFields=None)
                
api.delete_user('user_id')

api.upload_file(room_id='room_id',
                file='file',
                description='File description',
                message='Example message')

check /rocketchat/calls/api.py for more.

Running Tests

py.test tests rocketchat
Sending a message

You'll first need to get the _id of the room you want to send a message to. Currently, Rocket can only send messages to public rooms.

api.send_message('Your message', room_id)

rocket-python's People

Contributors

dstegelman avatar herewasmike avatar jadolg avatar kirill-shtrykov avatar pipozzz avatar rrzaripov avatar sir-twist avatar steven-kraft avatar

Watchers

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