From: Moritz Kiefer Date: Fri, 1 Feb 2013 22:38:16 +0000 (+0100) Subject: get_notifications() function X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=33f21ecf6e43275470e4e4ddae765867dadd0450;p=diaspy.git get_notifications() function --- 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