From: Moritz Kiefer Date: Sat, 2 Feb 2013 21:40:13 +0000 (+0100) Subject: Add function to delete post X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=5e809c8bf1104c6bbef55922abfdaffb694f9b9c;p=diaspy.git Add function to delete post --- diff --git a/diaspy/models.py b/diaspy/models.py index 526d501..20001ce 100644 --- a/diaspy/models.py +++ b/diaspy/models.py @@ -56,7 +56,7 @@ class Post: return r.json() - def rmlike(self): + def delete_like(self): """This function removes a like from a post """ @@ -123,7 +123,7 @@ class Post: return r.json() - def rmcomment(self, comment_id): + def delete_comment(self, comment_id): """This function removes a comment from a post :param post_id: id of the post to remove the like from. @@ -145,3 +145,17 @@ class Post: if r.status_code != 204: raise Exception(str(r.status_code) + ': Comment could not be deleted.') + + def delete(self): + """ This function deletes this post + + """ + + data = {'authenticity_token': self._client.get_token()} + + r = self._client.session.delete(self._client.pod + '/posts/' + + self.post_id, + data=data, + headers={'accept': 'application/json'}) + + return r