From 33f21ecf6e43275470e4e4ddae765867dadd0450 Mon Sep 17 00:00:00 2001 From: Moritz Kiefer Date: Fri, 1 Feb 2013 23:38:16 +0100 Subject: [PATCH] get_notifications() function --- diaspy/client.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/diaspy/client.py b/diaspy/client.py index 1807c20..0a91670 100644 --- a/diaspy/client.py +++ b/diaspy/client.py @@ -111,3 +111,20 @@ class Client: posts.append(diaspy.models.Post(str(post['id']), self)) return posts + + def get_notifications(self): + """This functions returns a list of notifications. + + :returns: list -- list of json formatted notifications + + """ + + + data = {'authenticity_token': self.get_token()} + r = self.session.get(self.pod + "/notifications.json") + + if r.status_code != 200: + raise Exception('wrong status code: ' + str(r.status_code)) + + notifications = r.json() + return notifications -- 2.25.1