GithubHelp home page GithubHelp logo

jcsaaddupuy / pyflowdock Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aeron/pyflowdock

0.0 2.0 1.0 102 KB

Simple Flowdock APIs wrapper with some useful helpers. Only Push API (Team Inbox and Chat) and Streaming API available at this moment.

Python 100.00%

pyflowdock's Introduction

PyFlowdock

Simple Flowdock APIs wrapper with some useful helpers. Only Push API (Team Inbox and Chat) and Streaming API available at this moment.

Installation

You know how to do it… Right? Just (sudo) pip install pyflowdock it or use (sudo) python setup.py install inside pyflowdock folder.

How to use it

Simple as a pie…

Push API

Team Inbox

from flowdock import TeamInbox
inbox = TeamInbox('your_flow_api_token')
# With all params
inbox.post('Source', '[email protected]', 'Subject', '<p>Content.</p>', 'From Name', '[email protected]', 'Project', 'format', ['tags', '@tags', '#tags'], 'http://link.example.com')
# With required params only
inbox.post('Source', '[email protected]', 'Subject', '<p>Content.</p>')
Required params
  • source Human readable identifier of the application that uses the Flowdock API. Only alphanumeric characters, underscores and whitespace can be used;
  • from_address Email address of the message sender. The email address is used to show a avatar (Gravatar) of the sender;
  • subject Subject line of the message, will be displayed as the title of Team Inbox message;
  • content Content of the message, will be displayed as the body of Team Inbox message.
Optional params
  • from_name Name of the message sender;
  • reply_to Email address for replies, will be used when replying to the message from Flowdock;
  • project Human readable identifier for more detailed message categorization. Only alphanumeric characters, underscores and whitespace can be used;
  • format Format of the message content, default value is "html". Only HTML is currently supported;
  • tags Tags of the message, separated by commas;
  • link Link associated with the message. This will be used to link the message subject in Team Inbox.

Chat

from flowdock import Chat
chat = Chat('your_flow_api_token')
# With all params
chat.post('Content', 'External User Name', ['tags', '@tags', '#tags'])
# With required params only
chat.post('Content', 'External User Name')
Required params
  • content Content of the message. Tags will be automatically parsed from the message content. Maximum length: 8096 characters;
  • external_user_name Name of the “user” sending the message.
Optional params
  • tags Tags of the message, separated by commas.

Streaming API

Streaming API supports two different content types, JSON stream and Event-Stream.

JSON stream and Event-Stream

from flowdock import JSONStream, EventStream
stream = JSONStream('your_personal_api_token')
# Or
stream = EventStream('your_personal_api_token')
# With all params
gen = stream.fetch('organization/flow', active='idle')
# With required params only
gen = stream.fetch(['organization/flow', 'organization/main'])
for data in gen:
	# do something with `data`
	print data
Required params
  • flows Flow or list of flows to fetch. Only strings and lists can be used.
Optional params
  • active Show user as active in Flowdock. Defined values True, 'idle' or None. If None, user will appear offline. Default: True;

Helpers

Logging

import logging
from flowdock.helpers import FlowdockTeamInboxLoggingHandler
# With all params
handler = FlowdockTeamInboxLoggingHandler('your_flow_api_token', 'Source', '[email protected]', 'From Name')
# With required params only
handler = FlowdockTeamInboxLoggingHandler('your_flow_api_token')
logger = logging.getLogger('your_logger')
logger.setLevel(logging.DEBUG)
logger.addHandler(handler)
logger.debug('Content')

pyflowdock's People

Contributors

aeron avatar

Watchers

 avatar James Cloos avatar

Forkers

blastworksinc

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.