GithubHelp home page GithubHelp logo

gitterpy's Introduction

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 [email protected]:MichaelYusko/GitterPy.git
  2. Feel free to make a PR;)

gitterpy's People

Contributors

myusko avatar alan-fgr avatar danmichaelo 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.