send a simple Campfire chat message from fabric script

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
import httplib2

def _send_campfire_message(message):
    """Send message to Campfire using your campfire login"""
    # SETUP: go to http://<your-campfire-subdomain>.campfirenow.com/member/edit
    # put your api key in ~/.fabricrc like:
    # campfire_api_key = abafdc8391ae67ce829accc9198df832f5f821eb13cac9fb
    if env.has_key('campfire_api_key'):
        data = '{"message":{"body":"-- %s --"}}' % message
        conn = httplib2.Http(timeout=3)
        conn.add_credentials(env.campfire_api_key, 'X')
        headers = {'content-type':'application/json'}
        url = "http://<your-campfire-subdomain>-bc.campfirenow.com/room/<your-room-id-number>/speak.json"
        conn.request(url, "POST", data, headers)

More like this

  1. Update ContentTypes and Permissions without syncdb by paltman 6 years ago
  2. SMTP sink server by twinsant 7 years, 1 month ago
  3. Severity codes in user messages by cconnell 5 years, 3 months ago
  4. Javascript Chain Select Widget by ogo 5 years, 10 months ago
  5. Using Templates to Send E-Mails by rpoulton 7 years, 1 month ago

Comments

(Forgotten your password?)