Git Product home page Git Product logo

python-simple-hipchat's Introduction

(Super simple) Python HipChat

Description

Easy peasy wrapper for the HipChat API v1. Exposes core URI endpoint wrapper and some basic methods for common integrations.

Dependencies

None beyond the Python standard library.

Usage

Install:

pip install python-simple-hipchat

Instantiate:

import hipchat
hipster = hipchat.HipChat(token=YourHipChatToken)

Request a URI endpoint as described in the HipChat API docs:

hipster.method(url='method/url/', method="GET/POST", parameters={'name':'value', })

Example:

# List rooms
hipster.method('rooms/list')

# Post a message to a HipChat room
hipster.method('rooms/message', method='POST', parameters={'room_id': 8675309, 'from': 'HAL', 'message': 'All your base...'})

API Sugar

To send a message to a room, either a Notification or Admin token can be used. All other methods require an Admin token. See HipChat's auth docs for more information.

Send a message to a room:

room_id = 8675309
from_name = 'HAL'
message = 'All your base...'

hipster.message_room(room_id, from_name, message)

# per HipChat, color can be "yellow", "red", "green", "purple", "gray", or "random"
message_color = 'gray'
hipster.message_room(room_id, from_name, message, color=message_color)

# notify users in the room
message_color = 'red'
hipster.message_room(room_id, from_name, message, color=message_color, notify=True)

List rooms:

hipster.list_rooms()

Find room by name:

room = hipster.find_room('Room Name')
print "Room Name has room id = %s" % (room['room_id'])

List users:

hipster.list_users()

Find user by name:

user = hipster.find_user('Raleigh Becket')
print "Raleigh Becket's status is = %s" % (user['status'])

Changelog

v0.3.x

  • Added shortcut method for listing users (thanks @Raizex)
  • Added shortcut method for finding user by name (thanks @Raizex)
  • Added shortcut method for finding room by name (thanks @Raizex)
  • Added trove classifiers (thanks @ghickman)

v0.2.x

v0.1.x

  • Added shortcut method for messaging a room
  • Added shortcut method for listing rooms

python-simple-hipchat's People

Contributors

raizex avatar kurttheviking avatar ghickman avatar mwarkentin avatar zachsnow avatar pimterry avatar

Watchers

Sunguk Lee 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.