From fcb4d06b7ba8979b7094e5b7048da0219c258bf2 Mon Sep 17 00:00:00 2001 From: Marek Marecki Date: Mon, 6 May 2013 00:35:37 +0200 Subject: [PATCH] Client().get_tag() can only return stream --- diaspy/client.py | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/diaspy/client.py b/diaspy/client.py index 85b7326..1db18f9 100644 --- a/diaspy/client.py +++ b/diaspy/client.py @@ -66,7 +66,7 @@ class Client: return self.stream def get_aspects(self): - """Returns /aspects stream. + """Returns aspects stream. :returns: diaspy.streams.Aspects """ @@ -86,24 +86,14 @@ class Client: """ return diaspy.streams.FollowedTags(self.connection) - def get_tag(self, tag, stream=False): + def get_tag(self, tag): """This functions returns a list of posts containing the tag. :param tag: Name of the tag :type tag: str - :param stream: specify wheter you want a stream object (True) or - normal list (False) - :type stream: bool - :returns: list -- list of Post objects + :returns: diaspy.streams.Generic -- stream containg posts with given tag """ - if stream: - tagged_posts = diaspy.streams.Generic(self.connection, location='tags/{0}.json'.format(tag)) - else: - r = self.connection.get('tags/{0}.json'.format(tag)) - if r.status_code != 200: - raise Exception('wrong status code: {0}'.format(r.status_code)) - tagged_posts = [diaspy.models.Post(str(post['id']), self.connection) for post in r.json()] - return tagged_posts + return diaspy.streams.Generic(self.connection, location='tags/{0}.json'.format(tag)) def get_notifications(self): """This functions returns a list of notifications. -- 2.25.1