From a66718b0a77220b1a97c22dbec26989b7f75a686 Mon Sep 17 00:00:00 2001 From: CYBERDEViLNL Date: Sat, 3 Nov 2018 23:39:49 +0100 Subject: [PATCH] Updated `Post()` to get data through `data()` since getitem is removed. --- diaspy/models.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/diaspy/models.py b/diaspy/models.py index 9535cb4..9468ddc 100644 --- a/diaspy/models.py +++ b/diaspy/models.py @@ -501,7 +501,7 @@ class Post(): self._fetchcomments() else: if not self._data: self._fetchdata() - self.comments.set_json( self['interactions']['comments'] ) + self.comments.set_json( self.data()['interactions']['comments'] ) def __repr__(self): """Returns string containing more information then str(). @@ -525,15 +525,15 @@ class Post(): raise errors.PostError('{0}: could not fetch data for post: {1}'.format(request.status_code, id)) elif request: self._data = request.json() - return self['guid'] + return self.data()['guid'] def _fetchcomments(self): """Retreives comments for this post. Retrieving comments via GUID will result in 404 error. DIASPORA* does not supply comments through /posts/:guid/ endpoint. """ - id = self._data['id'] - if self['interactions']['comments_count']: + id = self.data()['id'] + if self.data()['interactions']['comments_count']: request = self._connection.get('posts/{0}/comments.json'.format(id)) if request.status_code != 200: raise errors.PostError('{0}: could not fetch comments for post: {1}'.format(request.status_code, id)) -- 2.25.1