aboutsummaryrefslogtreecommitdiffstats
path: root/project/shoutboxapicommunicator.py
diff options
context:
space:
mode:
authorJan Tuomi <jan-sebastian.tuomi@aalto.fi>2016-07-21 18:16:16 +0300
committerJan Tuomi <jan-sebastian.tuomi@aalto.fi>2016-07-21 18:16:16 +0300
commit392a51b858dde0c68ce93a9415c3841062a70805 (patch)
tree2553cd5c34091ec15b5fa57e815c2a250ee2de51 /project/shoutboxapicommunicator.py
parente13ae89fcbd1543bf583e7a56f82ccaef4dfa8d4 (diff)
Add API token config parameter for API authentication
Diffstat (limited to 'project/shoutboxapicommunicator.py')
-rw-r--r--project/shoutboxapicommunicator.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/project/shoutboxapicommunicator.py b/project/shoutboxapicommunicator.py
index c30b408..21e7e8e 100644
--- a/project/shoutboxapicommunicator.py
+++ b/project/shoutboxapicommunicator.py
@@ -11,6 +11,7 @@ class ShoutboxCommunicator(BaseCommunicator):
url = "http://localhost:8000"
interval = 10
+ token = ""
@staticmethod
def get_url():
@@ -47,8 +48,9 @@ class ShoutboxCommunicator(BaseCommunicator):
@staticmethod
def send(data):
"""Send a message to the API"""
- post_params = "?user={}&text={}&id={}&ip={}&timestamp={}".format(
- data["user"], data["text"], data["id"], data["ip"], data["timestamp"]
+ post_params = "?user={}&text={}&id={}&ip={}&timestamp={}&api_token={}".format(
+ data["user"], data["text"], data["id"], data["ip"], data["timestamp"],
+ ShoutboxCommunicator.token
)
try: