Skip to content

Commit

Permalink
1. add method like(unlike) a post
Browse files Browse the repository at this point in the history
2. add method comment a post
  • Loading branch information
lyroge committed Feb 14, 2014
1 parent 23cde4a commit 6d5f8c9
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions linkedin/linkedin.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,27 @@ def submit_group_post(self, group_id, title, summary, submitted_url,
raise LinkedInError(response)
return True

def like_post(self, post_id, action):
url = '%s/%s/relation-to-viewer/is-liked' % (ENDPOINTS.POSTS, str(post_id))
try:
response = self.make_request('PUT', url, data=json.dumps(action))
except (requests.ConnectionError, requests.HTTPError), error:
raise LinkedInHTTPError(error.message)
else:
return True

def comment_post(self, post_id, comment):
post = {
'text': comment
}
url = '%s/%s/comments' % (ENDPOINTS.POSTS, str(post_id))
try:
response = self.make_request('POST', url, data=json.dumps(post))
except (requests.ConnectionError, requests.HTTPError), error:
raise LinkedInHTTPError(error.message)
else:
return True

def get_company_by_email_domain(self, email_domain, params=None, headers=None):
url = '%s?email-domain=%s' % (ENDPOINTS.COMPANIES, email_domain)
try:
Expand Down

0 comments on commit 6d5f8c9

Please sign in to comment.