예제 #1
0
파일: pushover.py 프로젝트: faizalps501/pai
    def _run(self):
        super(PushoverTextInterface, self)._run()

        self.app = chump.Application(cfg.PUSHOVER_KEY)
        if not self.app.is_authenticated:
            raise Exception(
                "Failed to authenticate with Pushover. Please check PUSHOVER_APPLICATION_KEY"
            )
예제 #2
0
파일: home.py 프로젝트: cslarsen/home-zwave
    def __init__(self, apikey, userkeys):
        self.app = chump.Application(apikey)
        assert (self.app.is_authenticated)

        self.users = []
        for userkey in userkeys:
            user = self.app.get_user(userkey)
            if user.is_authenticated:
                self.users.append(user)
                logging.info("Adding Pushover user with devices: %s" %
                             " ".join(user.devices))
            else:
                logging.warning("Pushover user not authenticated: %s" %
                                userkey)
예제 #3
0
    def __init__(self, inqueue, config):
        threading.Thread.__init__(self)
        self.inqueue = inqueue
        self.config = config
        self.logger = logging.getLogger('notify')
        self.nma = nma.NMAProvider(config['nma_keys'])
        self.chump_app = chump.Application(self.config['pover_app_id'])

        self.chump_users = [
            self.chump_app.get_user(x) for x in self.config['pover_keys']
        ]

        self.m365 = messaging365.M365Provider(*self.config['m365_login'])

        if 'db_file' in self.config:
            self.db_conn = sqlite3.connect(self.config['db_file'],
                                           check_same_thread=False)
            self.db_cursor = self.db_conn.cursor()
            self.make_db()
예제 #4
0
 def web_service_get(self):
     app = chump.Application(self.config['app'])
     return app.get_user(self.config['user'])
예제 #5
0
    def web_service_get(self):
        if chump is None:
            raise ImportError('Python module "chump" not installed')

        app = chump.Application(self.config['app'])
        return app.get_user(self.config['user'])
예제 #6
0
    try:
        with open(config_path, 'r') as config_fp:
            configuration = ConfigParser.ConfigParser()
            configuration.readfp(config_fp)
            return configuration
    except IOError:
        sys.exit("Config file not readable")


def push(torrent_name):
    configuration = read_config("pushover.cfg")
    try:
        api_token = configuration.get("Pushover", "api_token")
        user_key = configuration.get("Pushover", "user_key")
    except ConfigParser.NoSectionError, ConfigParser.NoOptionError:
        sys.exit("Config File missing tokens")

    app = chump.Application(api_token)
    user = app.get_user(user_key)

    title = "Download complete"
    message = torrent_name

    user.send_message(message, title=title)


if 'TR_TORRENT_NAME' not in os.environ:
    sys.exit("Torrent name not set")
else:
    push(os.environ['TR_TORRENT_NAME'])
예제 #7
0
    def _run(self):
        logger.info("Starting Pushover Interface")

        self.app = chump.Application(cfg.PUSHOVER_KEY)
        if not self.app.is_authenticated:
            raise Exception('Failed to authenticate with Pushover. Please check PUSHOVER_APPLICATION_KEY')