From ae7dbdb726dcfc2805e4f08bc36bceca1c645ca6 Mon Sep 17 00:00:00 2001 From: Nazmi ZORLU Date: Fri, 6 Nov 2015 21:59:37 +0300 Subject: [PATCH 1/5] Get Post Likes --- linkedin/linkedin.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/linkedin/linkedin.py b/linkedin/linkedin.py index 5c3a1b0..7c07eda 100644 --- a/linkedin/linkedin.py +++ b/linkedin/linkedin.py @@ -541,3 +541,13 @@ def like_update(self, update_key, is_liked=True): response = self.make_request('PUT', url, data=json.dumps(is_liked)) raise_for_error(response) return True + + def get_post_likes(self, post_id, selectors=None, params=None, + headers=None): + url = '%s/%s/likes' % (ENDPOINTS.POSTS, post_id) + if selectors: + url = '%s:(%s)' % (url, LinkedInSelector.parse(selectors)) + + response = self.make_request('GET', url, params=params, headers=headers) + raise_for_error(response) + return response.json() From 97364f5e994429882ef8e4060aeb9bead9dde4f3 Mon Sep 17 00:00:00 2001 From: Nazmi ZORLU Date: Fri, 6 Nov 2015 22:02:07 +0300 Subject: [PATCH 2/5] Get Network Shares Comments --- linkedin/linkedin.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/linkedin/linkedin.py b/linkedin/linkedin.py index 7c07eda..2c2dfa8 100644 --- a/linkedin/linkedin.py +++ b/linkedin/linkedin.py @@ -551,3 +551,14 @@ def get_post_likes(self, post_id, selectors=None, params=None, response = self.make_request('GET', url, params=params, headers=headers) raise_for_error(response) return response.json() + + def get_share_comments(self, post_id, selectors=None, params=None, + headers=None): + url = '%s/~/network/updates/key=%s/update-comments' % (ENDPOINTS.PEOPLE, + post_id) + if selectors: + url = '%s:(%s)' % (url, LinkedInSelector.parse(selectors)) + + response = self.make_request('GET', url, params=params, headers=headers) + raise_for_error(response) + return response.json() From 0ea141b08d071a0dc6e06a40909a91aa8837860a Mon Sep 17 00:00:00 2001 From: Nazmi ZORLU Date: Fri, 6 Nov 2015 22:05:54 +0300 Subject: [PATCH 3/5] Get Network Share's Likes --- linkedin/linkedin.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/linkedin/linkedin.py b/linkedin/linkedin.py index 2c2dfa8..8c5af6c 100644 --- a/linkedin/linkedin.py +++ b/linkedin/linkedin.py @@ -562,3 +562,13 @@ def get_share_comments(self, post_id, selectors=None, params=None, response = self.make_request('GET', url, params=params, headers=headers) raise_for_error(response) return response.json() + + def get_share_likes(self, post_id, selectors=None, params=None, + headers=None): + url = '%s/~/network/updates/key=%s/likes' % (ENDPOINTS.PEOPLE, post_id) + if selectors: + url = '%s:(%s)' % (url, LinkedInSelector.parse(selectors)) + + response = self.make_request('GET', url, params=params, headers=headers) + raise_for_error(response) + return response.json() From dae9589d95c48f031c1f1de1068b7b5843080d97 Mon Sep 17 00:00:00 2001 From: Nazmi ZORLU Date: Fri, 6 Nov 2015 22:09:36 +0300 Subject: [PATCH 4/5] Submit Group Post is improved. --- linkedin/linkedin.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/linkedin/linkedin.py b/linkedin/linkedin.py index 8c5af6c..45e5173 100644 --- a/linkedin/linkedin.py +++ b/linkedin/linkedin.py @@ -291,16 +291,16 @@ def leave_group(self, group_id): raise_for_error(response) return True - def submit_group_post(self, group_id, title, summary, submitted_url, - submitted_image_url, content_title, description): - post = { - 'title': title, 'summary': summary, - 'content': { + def submit_group_post(self, group_id, title, summary, submitted_url=None, + submitted_image_url=None, content_title=None, + description=None): + post = {'title': title, 'summary': summary} + if content_title and submitted_url: + post['content'] = { 'submitted-url': submitted_url, 'title': content_title, 'description': description } - } if submitted_image_url: post['content']['submitted-image-url'] = submitted_image_url From faf6531ed4e899889a3075df1c29f36b7be6c526 Mon Sep 17 00:00:00 2001 From: Nazmi ZORLU Date: Fri, 6 Nov 2015 22:13:39 +0300 Subject: [PATCH 5/5] Commenting as company. --- linkedin/linkedin.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/linkedin/linkedin.py b/linkedin/linkedin.py index 45e5173..4fabf17 100644 --- a/linkedin/linkedin.py +++ b/linkedin/linkedin.py @@ -572,3 +572,11 @@ def get_share_likes(self, post_id, selectors=None, params=None, response = self.make_request('GET', url, params=params, headers=headers) raise_for_error(response) return response.json() + + def comment_as_company(self, company_id, update_key, comment): + comment = {'comment': comment} + url = '%s/updates/key=%s/update-comments-as-company' % ( + ENDPOINTS.COMPANIES, company_id, update_key) + response = self.make_request('PUT', url, data=json.dumps(comment)) + raise_for_error(response) + return True