From 4b1645dc6f19c8cabbd2697ccaaf6f41a2cf7825 Mon Sep 17 00:00:00 2001 From: Marek Marecki Date: Thu, 8 Aug 2013 18:20:16 +0200 Subject: [PATCH] pydoc will now correctly read doctsing for diaspy/streams.py, Post().delete_like() now returns error code on success --- diaspy/models.py | 3 ++- diaspy/streams.py | 12 +++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/diaspy/models.py b/diaspy/models.py index ea88199..0c5f4f2 100644 --- a/diaspy/models.py +++ b/diaspy/models.py @@ -27,7 +27,7 @@ class Aspect(): elif name and not id: self.id = self._findid() elif not id and not name: - raise Exception("Aspect must be initialized with either an id or name") + raise Exception('Aspect must be initialized with either an id or name') def _findname(self): """Finds name for aspect. @@ -376,6 +376,7 @@ class Post(): if request.status_code != 204: raise errors.PostError('{0}: Comment could not be deleted' .format(request.status_code)) + return request.status_code def delete(self): """ This function deletes this post diff --git a/diaspy/streams.py b/diaspy/streams.py index d1834b9..461fb03 100644 --- a/diaspy/streams.py +++ b/diaspy/streams.py @@ -1,7 +1,3 @@ -import json -import time -from diaspy.models import Post, Aspect - """Docstrings for this module are taken from: https://gist.github.com/MrZYX/01c93096c30dc44caf71 @@ -10,6 +6,12 @@ http://pad.spored.de/ro/r.qWmvhSZg7rk4OQam """ +import json +import time +from diaspy.models import Post, Aspect +from diaspy import errors + + class Generic(): """Object representing generic stream. """ @@ -56,7 +58,7 @@ class Generic(): if max_time: params['max_time'] = max_time request = self._connection.get(self._location, params=params) if request.status_code != 200: - raise error.StreamError('wrong status code: {0}'.format(request.status_code)) + raise errors.StreamError('wrong status code: {0}'.format(request.status_code)) return [Post(self._connection, post['id']) for post in request.json()] def _expand(self, new_stream): -- 2.25.1