diff options
Diffstat (limited to 'shoutboxapicommunicator.py')
| -rw-r--r-- | shoutboxapicommunicator.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/shoutboxapicommunicator.py b/shoutboxapicommunicator.py index 57f6bc7..28a5b74 100644 --- a/shoutboxapicommunicator.py +++ b/shoutboxapicommunicator.py @@ -6,7 +6,8 @@ import logging class Communicator(object): - def fetch(self, url): + @staticmethod + def fetch(url): try: r = requests.get(url) logging.info("Response from API OK.") @@ -22,10 +23,11 @@ class Communicator(object): return content - def send(self, url, text, user): - data = {"text": text, "user": user} + @staticmethod + def send(url, data): try: requests.post(url, data) + user = json.loads(data)["user"] logging.info("Sent message from {} to shoutbox.".format(user)) except: - logging.warning("Failed to send message from {} to shoutbox API!".format(user))
\ No newline at end of file + logging.warning("Failed to send message to shoutbox API!")
\ No newline at end of file |
