5 """This class represents a post.
8 Remember that you need to have access to the post.
10 :params post_id: id or guid of the post
12 :params client: client object used to authenticate
16 The login function of the client should be called,
17 before calling any of the post functions.
21 def __init__(self
, post_id
, client
):
24 r
= self
._client
.session
.get(self
._client
.pod
+
28 if r
.status_code
== 200:
31 raise Exception('wrong status code: ' + str(r
.status_code
))
34 """This function likes a post
36 :returns: dict -- json formatted like object.
40 data
= {'authenticity_token': self
._client
.get_token()}
42 r
= self
._client
.session
.post(self
._client
.pod
+
44 str(self
.data
['id']) +
47 headers
={'accept': 'application/json'})
51 """This function removes a like from a post
55 data
= {'authenticity_token': self
._client
.get_token()}
57 r
= self
._client
.session
.delete(self
._client
.pod
+ '/posts/' +
58 str(self
.data
['id']) +
60 str(self
.data
['interactions']
65 """This function reshares a post
69 data
= {'root_guid': self
.data
['guid'],
70 'authenticity_token': self
._client
.get_token()}
72 r
= self
._client
.session
.post(self
._client
.pod
+
78 def comment(self
, text
):
79 """This function comments on a post
81 :param post_id: id of the post to comment on.
83 :param text: text to comment.
89 'authenticity_token': self
._client
.get_token()}
91 r
= self
._client
.session
.post(self
._client
.pod
+
93 str(self
.data
['id']) +
99 def rmcomment(self
, comment_id
):
100 """This function removes a comment from a post
102 :param post_id: id of the post to remove the like from.
104 :param like_id: id of the like to remove.
109 data
= {'authenticity_token': self
._client
.get_token()}
111 r
= self
._client
.session
.delete(self
._client
.pod
+ '/posts/' +
112 str(self
.data
['id']) +