{"id":17197141,"url":"https://github.com/michaelhelmick/linkedin","last_synced_at":"2025-04-13T19:31:00.541Z","repository":{"id":2256715,"uuid":"3212143","full_name":"michaelhelmick/linkedin","owner":"michaelhelmick","description":"A Python Library to interface with LinkedIn API, OAuth and JSON responses","archived":false,"fork":false,"pushed_at":"2017-02-15T01:05:21.000Z","size":64,"stargazers_count":68,"open_issues_count":4,"forks_count":30,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-04-10T20:14:43.918Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/michaelhelmick.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-01-18T20:36:47.000Z","updated_at":"2024-08-12T19:20:36.000Z","dependencies_parsed_at":"2022-09-02T03:40:35.398Z","dependency_job_id":null,"html_url":"https://github.com/michaelhelmick/linkedin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelhelmick%2Flinkedin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelhelmick%2Flinkedin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelhelmick%2Flinkedin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelhelmick%2Flinkedin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michaelhelmick","download_url":"https://codeload.github.com/michaelhelmick/linkedin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248767843,"owners_count":21158538,"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":[],"created_at":"2024-10-15T01:55:34.096Z","updated_at":"2025-04-13T19:31:00.284Z","avatar_url":"https://github.com/michaelhelmick.png","language":"Python","readme":"#Overview\nHere's another library based on the LinkedIn API, OAuth and JSON responses.\n\nHope this documentation explains everything you need to get started. Any questions feel free to email me or inbox me.\n\n#Install through pip...\n```\npip install linkedin\n```\n\nIf `linkedin` is already installed, pass `-I` to your install:\n```\npip install -I linkedin\n```\n\n#Import LinkedIn library\n```\nfrom linkedin import *\n```\n\n#Authorization URL\n\n*Get an authorization url for your user*\n\n```python\nl = LinkedinAPI(api_key='*your app key*',\n              api_secret='*your app secret*',\n              callback_url='http://www.example.com/callback/',\n              permissions=[\"r_network\"])\n\nauth_props = l.get_authentication_tokens()\nauth_url = auth_props['auth_url']\n\n#Store this token in a session or something for later use in the next step.\noauth_token_secret = auth_props['oauth_token_secret']\n\nprint 'Connect with LinkedIn via: %s' % auth_url\n```\nIf you leave callback_url blank, you can get the oauth_verifier from the web browser. It is a five-digit integer.\n\nThe permissions parameter is optional. It can be a list or string. The [list of permissions](https://developer.linkedin.com/documents/authentication) is in the LinkedIn API documentation.\n\nOnce you click \"Allow\" be sure that there is a URL set up to handle getting finalized tokens and possibly adding them to your database to use their information at a later date. \\n\\n'\n\n#Handling the callback\n```python\n# In Django, you'd do something like\n# oauth_token = request.GET.get('oauth_token')\n# oauth_verifier = request.GET.get('oauth_verifier')\n\noauth_token = *Grab oauth token from URL*\noauth_verifier = *Grab oauth verifier from URL*\n\n#Initiate the LinkedIn class in your callback.\nl = LinkedinAPI(api_key='*your app key*',\n              api_secret='*your app secret*',\n              oauth_token=oauth_token,\n              oauth_token_secret=session['linkedin_session_keys']['oauth_token_secret'])\n\nauthorized_tokens = l.get_access_token(oauth_verifier)\n\nfinal_oauth_token = authorized_tokens['oauth_token']\nfinal_oauth_token_secret = authorized_tokens['oauth_token_secret']\n\n# Save those tokens to the database for a later use?\n```\n\n#Getting some user information, search results, network updates.\n```python\n# Get the final tokens from the database or wherever you have them stored\n\nl = LinkedinAPI(api_key = '*your app key*',\n              api_secret = '*your app secret*',\n              oauth_token=final_tokens['oauth_token'],\n              oauth_token_secret=final_tokens['oauth_token_secret'])\n\n# Get your profile information (first name, last name)\nprofile = l.get('people/~', fields='first-name,last-name')\nprint profile\n\n# Get search results\nsearch = l.get('people-search', params={'keywords':'Hacker'})\nprint search\n\n# Get your network updates\nfeed = l.get('people/~/network/updates')\nprint feed\n```\n\n# POST a network update\n```python\nshare_content = { \n       \"comment\": \"Posting from the API using JSON\", \n       \"content\": { \n               \"title\": \"A title for your share\", \n               \"submitted-url\": \"http://www.linkedin.com\", \n               \"submitted-image-url\": \"http://lnkd.in/Vjc5ec\" \n       }, \n       \"visibility\": { \n               \"code\": \"anyone\" \n       } \n}\n\nshare_update = l.post('people/~/shares', params=share_content)\nprint share_update\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelhelmick%2Flinkedin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichaelhelmick%2Flinkedin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelhelmick%2Flinkedin/lists"}