From 415337b6b4966a1919cd57fd4bea4e5942884467 Mon Sep 17 00:00:00 2001 From: Marek Marecki Date: Sat, 14 Sep 2013 00:11:03 +0200 Subject: [PATCH] _fetchstream() method in User() object --- Changelog.markdown | 7 +++++++ diaspy/__init__.py | 2 +- diaspy/people.py | 6 +++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Changelog.markdown b/Changelog.markdown index 9754d4a..a1af97a 100644 --- a/Changelog.markdown +++ b/Changelog.markdown @@ -25,6 +25,13 @@ up-to-date than manual and if conflicts appear they should follow the order: * __bug__: `diaspy` has problems/can't connect to pods using SNI (this is an issue with requests/urllib3/python), +---- + +#### Version `0.4.1` (2013-09-): + +* __new__: `diaspy.people.User._fetchstream()` method, + + ---- #### Version `0.4.1` (2013-09-12): diff --git a/diaspy/__init__.py b/diaspy/__init__.py index 97a2143..36317c3 100644 --- a/diaspy/__init__.py +++ b/diaspy/__init__.py @@ -10,4 +10,4 @@ import diaspy.notifications as notifications import diaspy.settings as settings -__version__ = '0.4.1' +__version__ = '0.4.2' diff --git a/diaspy/people.py b/diaspy/people.py index 13aa747..67404ef 100644 --- a/diaspy/people.py +++ b/diaspy/people.py @@ -56,6 +56,9 @@ class User(): def __repr__(self): return '{0} ({1})'.format(self['diaspora_name'], self['guid']) + def _fetchstream(self): + self.stream = Outer(self._connection, location='people/{0}.json'.format(self['guid'])) + def _fetch(self, fetch): """Fetch user posts or data. """ @@ -91,7 +94,6 @@ class User(): request = request.json() if not len(request): raise errors.UserError('cannot extract user data: no posts to analyze') self.data = self._finalize_data(request[0]['author']) - self.stream = Outer(self._connection, location='people/{0}.json'.format(self['guid'])) def fetchhandle(self, protocol='https'): """Fetch user data and posts using Diaspora handle. @@ -99,6 +101,7 @@ class User(): pod, user = sephandle(self['handle']) request = self._connection.get('{0}://{1}/u/{2}.json'.format(protocol, pod, user), direct=True) self._postproc(request) + self._fetchstream() def fetchguid(self): """Fetch user data and posts using guid. @@ -106,6 +109,7 @@ class User(): if self['guid']: request = self._connection.get('people/{0}.json'.format(self['guid'])) self._postproc(request) + self._fetchstream() else: raise errors.UserError('GUID not set') -- 2.25.1