shvechikov / python-processor

A command line replacement for zapier and ifttt.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

python-processor

Badges

Documentation Status Travis-CI Build Status AppVeyor Build Status Coverage Status Code Quality Status Scrtinizer Status
PyPI Package latest release PyPI Package monthly downloads PyPI Wheel Supported versions Supported imlementations

Installation

Create viritualenv with python3::

virtualenv --python=python3 env
source env/bin/activate

If you are on OSX, then install lxml on OSX separately::

STATIC_DEPS=true pip install lxml

Then install the processor::

pip install processor

Now create an executable python script, where you'll place your pipline's configuration. Usually it is looks like that:

#!env/bin/python3
import os
from processor import run_pipeline, sources, outputs
from twiggy_goodies.setup import setup_logging


for_any_message = lambda msg: True

def prepare(tweet):
    return {'text': tweet['text'],
            'from': tweet['user']['screen_name']}

setup_logging('twitter.log')

run_pipeline(
    sources=[sources.twitter.search(
        'My Company',
        consumer_key='***', consumer_secret='***',
        access_token='***', access_secret='***',
        )],
    rules=[(for_any_message, [prepare, outputs.debug()])])

Running this code, will fetch new results for search by query My Company and output them on the screen. Of cause, you could use any other output, supported by the processor. Browse online documentation to find out which sources and outputs are supported and for to configure them.

Documentation

https://python-processor.readthedocs.org/

Development

To run the all tests run:

tox

Twitter source

  • Go to https://apps.twitter.com
  • Create new app.
  • Go to "Keys and Access Tokens" tabs.
  • Copy "Consumer Key", "Consumer Secret".
  • Create "Access Token" and "Access Secret" and copy them too.

About

A command line replacement for zapier and ifttt.

License:BSD 2-Clause "Simplified" License


Languages

Language:Hy 49.4%Language:Python 29.6%Language:PowerShell 14.0%Language:Shell 7.0%