Add __len__ to Notifications
[diaspy.git] / diaspy / notifications.py
index cb5b42f3ff25f984022eaca700cffec47bc93a44..e958030395897692042d85a3658377f331c0ee9f 100644 (file)
@@ -19,6 +19,9 @@ class Notifications():
                self._notifications = self.get()
                self.page = 1
 
+       def __len__(self):
+               return len(self._notifications)
+
        def __iter__(self):
                return iter(self._notifications)
 
@@ -39,7 +42,7 @@ class Notifications():
                request = self._connection.get('notifications.json', headers=headers, params=params)
 
                if request.status_code != 200:
-                       raise Exception('status code: {0}: cannot retreive notifications'.format(request.status_code))
+                       raise Exception('status code: {0}: cannot retrieve notifications'.format(request.status_code))
                return self._finalise(request.json())
 
        def _expand(self, new_notifications):