From dc2b3689a234605e9025e1f06d79883a34721219 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Mon, 30 Dec 2019 19:04:13 +0100 Subject: [PATCH] Fixes --- platypush/backend/ping.py | 4 ++-- platypush/plugins/ifttt.py | 22 ++++++++++++---------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/platypush/backend/ping.py b/platypush/backend/ping.py index f20001c03..321d44d11 100644 --- a/platypush/backend/ping.py +++ b/platypush/backend/ping.py @@ -14,8 +14,8 @@ class PingBackend(Backend): Triggers: - - :class:`platypush.message.ping.HostDownEvent` if a host stops responding ping requests - - :class:`platypush.message.ping.HostUpEvent` if a host starts responding ping requests + - :class:`platypush.message.event.ping.HostDownEvent` if a host stops responding ping requests + - :class:`platypush.message.event.ping.HostUpEvent` if a host starts responding ping requests """ diff --git a/platypush/plugins/ifttt.py b/platypush/plugins/ifttt.py index ae9a306ad..571ddb9bf 100644 --- a/platypush/plugins/ifttt.py +++ b/platypush/plugins/ifttt.py @@ -1,8 +1,8 @@ import requests -from platypush.message import Message from platypush.plugins import Plugin, action + class IftttPlugin(Plugin): """ This plugin allows you to interact with the IFTTT maker API @@ -30,16 +30,17 @@ class IftttPlugin(Plugin): _base_url = 'https://maker.ifttt.com/trigger/{event_name}/with/key/{ifttt_key}' - def __init__(self, ifttt_key, *args, **kwargs): + def __init__(self, ifttt_key, **kwargs): """ - :param ifttt_key: Your IFTTT Maker API key. Log in to IFTTT and get your key from . Once you've got your key, you can start creating IFTTT rules using the Webhooks channel. + :param ifttt_key: Your IFTTT Maker API key. Log in to IFTTT and get your key from + `here `_. Once you've got your key, you can start creating IFTTT rules + using the Webhooks channel. :type ifttt_key: str """ - super().__init__(*args, **kwargs) + super().__init__(**kwargs) self.ifttt_key = ifttt_key - @action def trigger_event(self, event_name, values=None): """ @@ -48,7 +49,8 @@ class IftttPlugin(Plugin): :param event_name: Name of the event :type event_name: str - :param values: Optional list of values to be passed to the event. By convention IFTTT names the values as ``value1,value2,...``. + :param values: Optional list of values to be passed to the event. By convention IFTTT names the values as + ``value1,value2,...``. :type values: list """ @@ -56,12 +58,12 @@ class IftttPlugin(Plugin): if not values: values = [] - response = requests.post(url, json={'value{}'.format(i+1): v - for (i,v) in enumerate(values)}) + response = requests.post(url, json={'value{}'.format(i + 1): v + for (i, v) in enumerate(values)}) if not response.ok: - raise RuntimeError("IFTTT event '{}' error: {}: {}".format(event_name, r.status_code, r.reason)) + raise RuntimeError("IFTTT event '{}' error: {}: {}".format( + event_name, response.status_code, response.reason)) # vim:sw=4:ts=4:et: -