Skip to content

Commit 837e692

Browse files
committed
Merge pull request ozgur#76 from yprez/fix-submitted-image-url
Fix bug with submitted-image-url being empty or None
2 parents 5057401 + 922ff39 commit 837e692

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

linkedin/linkedin.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,11 +292,13 @@ def submit_group_post(self, group_id, title, summary, submitted_url,
292292
'title': title, 'summary': summary,
293293
'content': {
294294
'submitted-url': submitted_url,
295-
'submitted-image-url': submitted_image_url,
296295
'title': content_title,
297296
'description': description
298297
}
299298
}
299+
if submitted_image_url:
300+
post['content']['submitted-image-url'] = submitted_image_url
301+
300302
url = '%s/%s/posts' % (ENDPOINTS.GROUPS, str(group_id))
301303
response = self.make_request('POST', url, data=json.dumps(post))
302304
raise_for_error(response)
@@ -402,9 +404,10 @@ def submit_company_share(self, company_id, comment=None, title=None, description
402404
post['content'] = {
403405
'title': title,
404406
'submitted-url': submitted_url,
405-
'submitted-image-url': submitted_image_url,
406407
'description': description,
407408
}
409+
if submitted_image_url:
410+
post['content']['submitted-image-url'] = submitted_image_url
408411

409412
url = '%s/%s/shares' % (ENDPOINTS.COMPANIES, company_id)
410413

@@ -451,9 +454,10 @@ def submit_share(self, comment=None, title=None, description=None,
451454
post['content'] = {
452455
'title': title,
453456
'submitted-url': submitted_url,
454-
'submitted-image-url': submitted_image_url,
455457
'description': description,
456458
}
459+
if submitted_image_url:
460+
post['content']['submitted-image-url'] = submitted_image_url
457461

458462
url = '%s/~/shares' % ENDPOINTS.PEOPLE
459463
response = self.make_request('POST', url, data=json.dumps(post))

0 commit comments

Comments
 (0)