Skip to content
Python interface for the Gitter API
Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
gitterpy Bump version May 24, 2018
tests Add user, messages tests May 12, 2017
.gitignore Update realease version in README file, also update gitignore file Oct 19, 2017
.travis.yml init commit May 8, 2017
LICENSE Add LICENSE file, and change version Jun 3, 2017
README.md
requirements.txt
setup.py Update requests package. Nov 1, 2018
tox.ini Fix ImportError, when tried download from pypi Jun 3, 2017

README.md

GitterPy

Python 3 interface for the Gitter API

Build Status PyPI version

Releases

  • 0.1.7 - PyPi

Installation

pip install gitterpy

Usage

Auth

from gitterpy.client import GitterClient

# Once create instance
gitter = GitterClient('YOUR_TOKEN')

# Check_my id
gitter.auth.get_my_id # return {'name': 'Freshjelly', 'user_id': '5332131921'}

Rooms

# Join into the room
gitter.rooms.join('gitterHQ/sandbox')

# Leave from the room
gitter.rooms.leave('gitterHQ/sandbox')

# List of rooms
gitter.rooms.rooms_list

# Grab room
gitter.rooms.grab_room('gitterHQ/sandbox')

# Room sub-resource
gitter.rooms.sub_resource('gitterHQ/sandbox')

# Update room topic
gitter.rooms.update('test-gitter/test1', 'My updated topic')

# Delete the room
gitter.rooms.delete_room('test-gitter/test1') #  {'success': True}

Messages

# Send a message to #gitterHQ/sandbox room
gitter.messages.send('gitterHQ/sandbox', 'Hello everyone')

# Message list
gitter.messages.list('gitterHQ/sandbox')

# Get single message by id
gitter.messages.get_message('gitterHQ/sandbox', '5903a16d6a471')

Groups

# List of groups
gitter.groups.groups_list

User

# Current user
gitter.user.current_user #  [{'displayName': 'freshjelly', 'id': '3131', ...}]

# User sub-resource
gitter.user.sub_resource # [{'noindex': True, 'id': '3131', ...}]

# User unread-items
gitter.user.unread_items('gitterHQ/sandbox') # {'mention': [], 'chat': []}

# Mark all messages in the room as read
gitter.user.mark_as_read('test-gitter/Lobby') # {'success': True}

# User orgs
gitter.user.orgs # [{'name': 'bla bla', 'description': 'blabla', ...}]

# User repos
gitter.user.repos # [{'name': 'MichaelYusko/GitterPy', 'description': 'Python for the Gitter API', ...}]

# User channels
gitter.user.channels

Stream

# Chat messages

response = gitter.stream.chat_messages('gitterHQ/sandbox')

for stream_messages in response.iter_lines():
    if stream_messages:
        print(stream_messages)

# Events
gitter.stream.events('gitterHQ/sandbox')

Contribution

  1. git clone git@github.com:MichaelYusko/GitterPy.git
  2. Feel free to make a PR;)
You can’t perform that action at this time.