{"id":24211510,"url":"https://github.com/ramibch/linkedin-posts","last_synced_at":"2025-06-12T03:38:47.962Z","repository":{"id":191623197,"uuid":"685194190","full_name":"ramibch/linkedin-posts","owner":"ramibch","description":"Utility to share Linkedin posts using the Linkedin Marketing API","archived":false,"fork":false,"pushed_at":"2023-12-27T10:51:09.000Z","size":1881,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-12T16:41:17.845Z","etag":null,"topics":["api-wrapper","http","linkedin","linkedin-api","linkedinapi","marketing","marketing-automation","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ramibch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-30T17:55:24.000Z","updated_at":"2023-11-27T06:07:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"6a5e1828-35d5-4db0-b1b7-0518837556f4","html_url":"https://github.com/ramibch/linkedin-posts","commit_stats":null,"previous_names":["ramiboutas/linkedin-posts","ramibch/linkedin-posts"],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ramibch%2Flinkedin-posts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ramibch%2Flinkedin-posts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ramibch%2Flinkedin-posts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ramibch%2Flinkedin-posts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ramibch","download_url":"https://codeload.github.com/ramibch/linkedin-posts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233835320,"owners_count":18737655,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-wrapper","http","linkedin","linkedin-api","linkedinapi","marketing","marketing-automation","python"],"created_at":"2025-01-14T02:35:36.473Z","updated_at":"2025-01-14T02:35:38.388Z","avatar_url":"https://github.com/ramibch.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LinkedIn Posts\n\nUtility to share LinkedIn posts using the LinkedIn Marketing API\n\nMade easy to use in Python.\n\n## Installation and Setup\n\n### Install with pip\n\n``` sh\npython -m pip install linkedin-posts\n```\n\n### Generate LinkedIn's Access Token\n\nThe quickest way to get an Access Token is by using the [LinkedIn Token generator tool](https://www.linkedin.com/developers/tools/oauth/token-generatorL)\n\n\n\n## Usage \n\n\n### Share a post\n\nBy the time I am writing this sentence, this is the most useful function\nof this package.\n\nShare a post by using the function `share_post` with some\narguments.\n\n``` python\nfrom linkedin_posts.posts import share_post\n\nresponse = share_post(\n  \"\u003cHERE YOUR ACCESS TOKEN\u003e\",\n  comment=\"publishing a post\",\n  author_type=\"organization\",\n  author_id=\"71513925\",\n)\n\n# Do something with your response object r (http.client.HttpResponse)\n# Interesting parameters to check:\n# response.getheader(\"x-restli-id\") will return the LinkedIn Post ID\n# response.code will return 201 if request proccessed correctly\n...\n```\n\n### Delete a post\n\nDeleting a post is very straightforward.\n\nJust just need the access token and pass the LinkedIn Post ID.\n\n``` python\nfrom linkedin_posts.posts import delete_post\n\nresponse = delete_post(\"\u003cHERE YOUR ACCESS TOKEN\u003e\", \"urn:li:share:7104319981684674560\")\n\n# response.code will return 204 if request proccessed correctly\n```\n\n### Create a poll post\n\nIt is possible to share a post with a poll by using the following code:\n\n``` python\nfrom linkedin_posts.polls import share_poll\n\nresponse = share_poll(\n  \"\u003cHERE YOUR ACCESS TOKEN\u003e\",\n  comment=\"Hello, this is just a test...\",\n  poll_question=\"Is this is a nice poll?\",\n  poll_options=[\"Yes\", \"No\", \"I do not care\"],\n  author_type=\"organization\",\n  author_id=\"71513925\",\n)\n\n# do something with response if you need to!\n```\n\nNow go to your [LinkedIn page](https://www.linkedin.com/company/nice-cv/) and check your published poll!\n\n[![image](img/poll_example.png)](https://www.linkedin.com/company/nice-cv/)\n\n### Post with media\n\nTo create a post with a nice picture you can use this code.\n\n``` python\n# upload a image\nupload_request, image_urn = upload_image(\n    \"\u003cHERE YOUR ACCESS TOKEN\u003e\",\n    file=\"img/nicecv.jpg\",\n    author_type=author_type,\n    author_id=author_id,\n)\n\n# create a post with the uploaded image\nshare_post_with_media(\n    \"\u003cHERE YOUR ACCESS TOKEN\u003e\",\n    comment=\"Do you like this nice cv?\",\n    author_type=author_type,\n    author_id=author_id,\n    media_id=image_urn\n)\n```\n\nAnd voilà. Here is your post!\n\n[![image](img/image_with_post_example.png)](https://www.linkedin.com/company/nice-cv/)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Framibch%2Flinkedin-posts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Framibch%2Flinkedin-posts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Framibch%2Flinkedin-posts/lists"}