ea22b45d3d6a76a212d0362584d86860d9ae5f14
4 def __init__(self
, post_id
, client
):
6 r
= self
._client
.session
.get(self
._client
.pod
+ '/posts/' + post_id
+ '.json')
7 if r
.status_code
== 200:
10 raise Exception('wrong status code: ' + str(r
.status_code
))
13 """This function likes a post
15 :returns: dict -- json formatted like object.
19 data
= {'authenticity_token': self
._client
.get_token()}
21 r
= self
._client
.session
.post(self
._client
.pod
+
23 str(self
.data
['id']) +
26 headers
={'accept': 'application/json'})
30 """This function removes a like from a post
34 data
= {'authenticity_token': self
._client
.get_token()}
36 r
= self
._client
.session
.delete(self
._client
.pod
+ '/posts/' +
37 str(self
.data
['id']) +
39 str(self
.data
['interactions']['likes'][0]['id']),
43 """This function reshares a post
47 data
= {'root_guid': self
.data
['guid'],
48 'authenticity_token': self
._client
.get_token()}
50 r
= self
._client
.session
.post(self
._client
.pod
+
56 def comment(self
, text
):
57 """This function comments on a post
59 :param post_id: id of the post to comment on.
61 :param text: text to comment.
67 'authenticity_token': self
._client
.get_token()}
69 r
= self
._client
.session
.post(self
._client
.pod
+ '/posts/' + str(self
.data
['id']) + '/comments', data
=data
)
73 def rmcomment(self
, comment_id
):
74 """This function removes a comment from a post
76 :param post_id: id of the post to remove the like from.
78 :param like_id: id of the like to remove.
83 data
= {'authenticity_token': self
._client
.get_token()}
85 r
= self
._client
.session
.delete(self
._client
.pod
+ '/posts/' +
86 str(self
.data
['id']) +