get_notifications() function
authorMoritz Kiefer <moritz.kiefer@gmail.com>
Fri, 1 Feb 2013 22:38:16 +0000 (23:38 +0100)
committerMoritz Kiefer <moritz.kiefer@gmail.com>
Fri, 1 Feb 2013 22:38:16 +0000 (23:38 +0100)
diaspy/client.py

index 1807c201688ea462d32f8deac765c75e483a96ed..0a916706f1c2f2ec1e72ec865bfd02100fb35062 100644 (file)
@@ -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