aboutsummaryrefslogtreecommitdiffstats
path: root/project
diff options
context:
space:
mode:
authorJan Tuomi <jans.tuomi@gmail.com>2017-04-17 15:33:41 +0300
committerJan Tuomi <jans.tuomi@gmail.com>2017-04-17 15:33:41 +0300
commit6c609d9178a678e2b7c6fb6a17539fc8fe6500a0 (patch)
treec425b85ccfef432e85491950228858560aa1cb91 /project
parentd0cd0d94453701235b732fefd63c45e906a15128 (diff)
Sort incoming API data by id
Diffstat (limited to 'project')
-rw-r--r--project/shoutboxapicommunicator.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/project/shoutboxapicommunicator.py b/project/shoutboxapicommunicator.py
index b9e57b6..6655fd3 100644
--- a/project/shoutboxapicommunicator.py
+++ b/project/shoutboxapicommunicator.py
@@ -46,7 +46,8 @@ class ShoutboxCommunicator(BaseCommunicator):
if len(content) > 0:
logging.info("Messages from shoutbox:")
- for msg in content:
+ sorted_content = sorted(content, key=lambda k: k["id"])
+ for msg in sorted_content:
logging.info("{}: {}, id: {}".format(msg["user"], msg["text"], msg["id"]))
id_dec = int(msg["id"], 16)