From: Alex Schroeder Date: Sun, 18 Aug 2019 18:30:23 +0000 (+0200) Subject: Add __len__ to Notifications X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=c31c193dedac49d3be906787528c321378c20092;p=diaspy.git Add __len__ to Notifications --- diff --git a/diaspy/notifications.py b/diaspy/notifications.py index cb5b42f..79709bb 100644 --- a/diaspy/notifications.py +++ b/diaspy/notifications.py @@ -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):