예제 #1
0
from matterhook import Webhook
from flask import Flask
from flask import request
from slugify import slugify

from matterllo.parser import Parser
from matterllo.utils import config

logging.basicConfig(
    level=logging.INFO, format='[%(asctime)s] [%(levelname)s] %(message)s')


app = Flask(__name__)
# NOTE: ugly way to load settings.
settings = config()
BEACON = b64decode('R0lGODlhAQABAIAAANvf7wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==')


class Send(object):

    def __init__(self, parser, board, action, payload):
        """ Init the necessary stuff to sent the event.

        Args:
            parser (object): see matterllo/parser.py.
            board (str): the name board.
            action (dict): the trello action data.
            payload (str): the event payload.
        """
        self.parser = parser
예제 #2
0
    A simple script to manage the webhook.

    :copyright: (c) 2016 by Lujeni.
    :license: BSD, see LICENSE for more details.
"""
import argparse
import sys

from trello import TrelloClient
from slugify import slugify

from matterllo.utils import config
from matterllo.utils import logger

SETTINGS = config()
LOGGING = logger()


def main():
    try:
        parser = argparse.ArgumentParser(description="Webhook helpers")
        parser.add_argument('--cleanup', dest='cleanup', action='store_true', help='delete webhook from your SETTINGS.')
        parser.add_argument('--update', dest='update', action='store_true', help='upsert webhook from your SETTINGS.')
        parser.add_argument('--init', dest='init', action='store_true', help='delete and create webhook from your SETTINGS.')

        args = parser.parse_args()
        if not args.cleanup and not args.update and not args.init:
            print parser.print_help()
            sys.exit(0)