{ "info": { "author": "Rei Colina", "author_email": "reinaldo13+github@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4" ], "description": "# Python LinkedIn V2\n\nPython interface to the LinkedIn API V2\n\n[![LinkedIn](https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRqi-foxSAvvgys60fsWa8k5ZXPtG5smzSXF5oBo3g9c1uxPEUOaw)](http://developer.linkedin.com)\n\nThis library provides a pure Python interface to the LinkedIn **Profile** and **Connections** REST APIs.\n\n[LinkedIn](http://developer.linkedin.com) provides a service that lets people bring their LinkedIn profiles and networks with them to your site or application via their OAuth based API. This library provides a lightweight interface over a complicated LinkedIn OAuth based API to make it for python programmers easy to use.\n\n## Installation\n\nYou can install **python-linkedin-v2** library via pip:\n\n $ pip install python-linkedin-v2\n\n## Authentication\n\nThe LinkedIn REST API now supports the **OAuth 2.0** protocol for authentication. This package provides a full OAuth 2.0 implementation for connecting to LinkedIn as well as an option for using an OAuth 1.0a flow that can be helpful for development purposes or just accessing your own data.\n\n### HTTP API example\n\nSet `LINKEDIN_API_KEY` and `LINKEDIN_API_SECRET`, configure your app to redirect to `http://localhost:8080/code`, then execute:\n\n 0. `http_api.py`\n 1. Visit `http://localhost:8080` in your browser, curl or similar\n 2. A tab in your browser will open up, give LinkedIn permission there\n 3. You'll then be presented with a list of available routes, hit any, e.g.:\n 4. `curl -XGET http://localhost:8080/get_profile`\n\n### Developer Authentication\n\nTo connect to LinkedIn as a developer or just to access your own data, you don't even have to implement an OAuth 2.0 flow that involves redirects. You can simply use the 4 credentials that are provided to you in your LinkedIn appliation as part of an OAuth 1.0a flow and immediately access your data. Here's how:\n\n```python\nfrom linkedin_v2 import linkedin\n\n# Define CONSUMER_KEY, CONSUMER_SECRET, \n# USER_TOKEN, and USER_SECRET from the credentials \n# provided in your LinkedIn application\n\n# Instantiate the developer authentication class\n\nauthentication = linkedin.LinkedInDeveloperAuthentication(CONSUMER_KEY, CONSUMER_SECRET, \n USER_TOKEN, USER_SECRET, \n RETURN_URL, linkedin.PERMISSIONS.enums.values())\n\n# Pass it in to the app...\n\napplication = linkedin.LinkedInApplication(authentication)\n\n# Use the app....\n\napplication.get_profile()\n```\n\n\n### Production Authentication\nIn order to use the LinkedIn OAuth 2.0, you have an **application key** and **application secret**. You can get more detail from [here](http://developers.linkedin.com/documents/authentication).\n\nFor debugging purposes you can use the credentials below. It belongs to my test application. Nothing's harmful.\n\n```python\nKEY = 'wFNJekVpDCJtRPFX812pQsJee-gt0zO4X5XmG6wcfSOSlLocxodAXNMbl0_hw3Vl'\nSECRET = 'daJDa6_8UcnGMw1yuq9TjoO_PMKukXMo8vEMo7Qv5J-G3SPgrAV0FqFCd0TNjQyG'\n```\nYou can also get those keys from [here](http://developer.linkedin.com/rest).\n\nLinkedIn redirects the user back to your website's URL after granting access (giving proper permissions) to your application. We call that url **RETURN URL**. Assuming your return url is **http://localhost:8000**, you can write something like this:\n\n```python\nfrom linkedin_v2 import linkedin\n\nAPI_KEY = 'wFNJekVpDCJtRPFX812pQsJee-gt0zO4X5XmG6wcfSOSlLocxodAXNMbl0_hw3Vl'\nAPI_SECRET = 'daJDa6_8UcnGMw1yuq9TjoO_PMKukXMo8vEMo7Qv5J-G3SPgrAV0FqFCd0TNjQyG'\nRETURN_URL = 'http://localhost:8000'\n\nauthentication = linkedin.LinkedInAuthentication(API_KEY, API_SECRET, RETURN_URL, linkedin.PERMISSIONS.enums.values())\n# Optionally one can send custom \"state\" value that will be returned from OAuth server\n# It can be used to track your user state or something else (it's up to you)\n# Be aware that this value is sent to OAuth server AS IS - make sure to encode or hash it\n#authorization.state = 'your_encoded_message'\nprint authentication.authorization_url # open this url on your browser\napplication = linkedin.LinkedInApplication(authentication)\n```\nWhen you grant access to the application, you will be redirected to the return url with the following query strings appended to your **RETURN_URL**:\n\n```python\n\"http://localhost:8000/?code=AQTXrv3Pe1iWS0EQvLg0NJA8ju_XuiadXACqHennhWih7iRyDSzAm5jaf3R7I8&state=ea34a04b91c72863c82878d2b8f1836c\"\n```\n\nThis means that the value of the **authorization_code** is **AQTXrv3Pe1iWS0EQvLg0NJA8ju_XuiadXACqHennhWih7iRyDSzAm5jaf3R7I8**. After setting it by hand, we can call the **.get_access_token()** to get the actual token.\n\n```python\nauthentication.authorization_code = 'AQTXrv3Pe1iWS0EQvLg0NJA8ju_XuiadXACqHennhWih7iRyDSzAm5jaf3R7I8'\nauthentication.get_access_token()\n```\n\nAfter you get the access token, you are now permitted to make API calls on behalf of the user who granted access to you app. In addition to that, in order to prevent from going through the OAuth flow for every consecutive request,\none can directly assign the access token obtained before to the application instance.\n\n```python\napplication = linkedin.LinkedInApplication(token='AQTFtPILQkJzXHrHtyQ0rjLe3W0I')\n```\n\n## Profile API\nThe Profile API returns a member's LinkedIn profile. For more information, check out the [documentation](http://developers.linkedin.com/documents/profile-api).\n\n```python\napplication.get_profile()\n{\n \"id\": \"yrZCpj2Z12\",\n \"firstName\": {\n \"localized\": {\n \"en_US\": \"Bob\"\n },\n \"preferredLocale\": {\n \"country\": \"US\",\n \"language\": \"en\"\n }\n },\n \"lastName\": {\n \"localized\": {\n \"en_US\": \"Smith\"\n },\n \"preferredLocale\": {\n \"country\": \"US\",\n \"language\": \"en\"\n }\n },\n \"location\": {\n \"countryCode\": \"us\",\n \"postalCode\": \"94101\",\n \"standardizedLocationUrn\": \"urn:li:standardizedLocationKey:(us,94101)\"\n },\n \"positions\": {\n \"660879450\": {\n \"companyName\": {\n \"localized\": {\n \"en_US\": \"LinkedIn\"\n },\n \"preferredLocale\": {\n \"country\": \"US\",\n \"language\": \"en\"\n }\n },\n \"id\": 660879450,\n \"title\": {\n \"localized\": {\n \"en_US\": \"Staff Software Engineer\"\n },\n \"preferredLocale\": {\n \"country\": \"US\",\n \"language\": \"en\"\n }\n }\n }\n },\n \"headline\": {\n \"localized\": {\n \"en_US\": \"API Enthusiast at LinkedIn\"\n },\n \"preferredLocale\": {\n \"country\": \"US\",\n \"language\": \"en\"\n }\n }\n}\n```\n\n## Connections API\nThe Connections API returns a list of **1st degree** connections for a user who has granted access to their account. For more information, you check out its [documentation](http://developers.linkedin.com/documents/connections-api).\n\nTo fetch your connections, you simply call **.get_connections()** method with proper GET querystring:\n\n```python\napplication.get_connections()\n{\n \"elements\": [\n {\n \"to\": \"urn:li:person:9HfhE6QlBz\"\n }\n ],\n \"paging\": {\n \"total\": 1,\n \"count\": 50,\n \"start\": 0,\n \"links\": []\n }\n}\n\napplication.get_connections(totals_only=True)\n{\n \"elements\":[\n\n ],\n \"paging\":{\n \"total\":303,\n \"count\":0,\n \"start\":0\n }\n}\n```\n\n## Throttle Limits\n\nLinkedIn API keys are throttled by default. You should take a look at the [Throttle Limits Documentation](http://developer.linkedin.com/documents/throttle-limits) to get more information about it.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/HootsuiteLabs/python-linkedin-v2", "keywords": "linkedin python", "license": "MIT", "maintainer": "Rei Colina", "maintainer_email": "reinaldo13+github@gmail.com", "name": "python-linkedin-v2", "package_url": "https://pypi.org/project/python-linkedin-v2/", "platform": "", "project_url": "https://pypi.org/project/python-linkedin-v2/", "project_urls": { "Homepage": "https://github.com/HootsuiteLabs/python-linkedin-v2" }, "release_url": "https://pypi.org/project/python-linkedin-v2/0.9.5/", "requires_dist": [ "requests (>=1.1.0)", "requests-oauthlib (>=0.3)" ], "requires_python": "", "summary": "Python Interface to the LinkedIn API V2", "version": "0.9.5" }, "last_serial": 4376236, "releases": { "0.9": [ { "comment_text": "", "digests": { "md5": "e15e5bd86e424a55d736165a81372ca6", "sha256": "694b2ef47cbc37b9e65caaf584a49193ac2577ff131c5eb49356b6aada038e7d" }, "downloads": -1, "filename": "python-linkedin-v2-0.9.tar.gz", "has_sig": false, "md5_digest": "e15e5bd86e424a55d736165a81372ca6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7698, "upload_time": "2018-01-11T22:11:11", "url": "https://files.pythonhosted.org/packages/e1/4d/31b0cd1a9bf28623fcb1a4d010b9b8932dcb9b9a77055cd186fed54d563c/python-linkedin-v2-0.9.tar.gz" } ], "0.9.1": [ { "comment_text": "", "digests": { "md5": "8ddb5e42fb0e31c0f95b50804b02eba9", "sha256": "ff6443db4e1afc7f633d981893946e74ddd4bf9e2741ae5d1a75d9667bbd5b2a" }, "downloads": -1, "filename": "python-linkedin-v2-0.9.1.tar.gz", "has_sig": false, "md5_digest": "8ddb5e42fb0e31c0f95b50804b02eba9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7802, "upload_time": "2018-02-23T00:13:20", "url": "https://files.pythonhosted.org/packages/7e/47/2b6b78e6ce79fb91e2d67b67b21e63d7c43dfd2047c74a0730049d4807c9/python-linkedin-v2-0.9.1.tar.gz" } ], "0.9.2": [ { "comment_text": "", "digests": { "md5": "47951e3030d0b1854eb10af92c5cef7f", "sha256": "f0a7c1c6a479e1aba9ddf9afabdd1c3fb404d29928f6a8223d8c9fe9c9d77e25" }, "downloads": -1, "filename": "python-linkedin-v2-0.9.2.tar.gz", "has_sig": false, "md5_digest": "47951e3030d0b1854eb10af92c5cef7f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7785, "upload_time": "2018-10-15T03:55:12", "url": "https://files.pythonhosted.org/packages/71/b3/f3678380e81294606aa9d6b69d2974f81a27f97394249229c9b418e744ca/python-linkedin-v2-0.9.2.tar.gz" } ], "0.9.4": [ { "comment_text": "", "digests": { "md5": "99e5cee04560ab236451423f619c3977", "sha256": "a80e1a0209ac6a65127e7a09a861c51f996d7083f83a582a26ac94e862863a2e" }, "downloads": -1, "filename": "python_linkedin_v2-0.9.4-py2-none-any.whl", "has_sig": false, "md5_digest": "99e5cee04560ab236451423f619c3977", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 10203, "upload_time": "2018-10-15T04:30:26", "url": "https://files.pythonhosted.org/packages/05/20/39c37827555fac4625bab98a9e1b4c3e3160b10bf1974b4042427dba057a/python_linkedin_v2-0.9.4-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "04a5f7e1da8555ff5a3b95a0212b3ad7", "sha256": "91706d205ed15636b571954179b2c977113d83b0c690a78fdb81092e2ef41be2" }, "downloads": -1, "filename": "python-linkedin-v2-0.9.4.tar.gz", "has_sig": false, "md5_digest": "04a5f7e1da8555ff5a3b95a0212b3ad7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9281, "upload_time": "2018-10-15T04:19:22", "url": "https://files.pythonhosted.org/packages/19/ab/bc44856c6ce9476627fc424e53220f6e13ab26f66e7b5237083c9553fb05/python-linkedin-v2-0.9.4.tar.gz" } ], "0.9.5": [ { "comment_text": "", "digests": { "md5": "aee0e624be42ff548216aa77b294cf7e", "sha256": "9c9cd5b48340ee55af1761c6d79cefbdba39e145458c373c16b88dea93dc235a" }, "downloads": -1, "filename": "python_linkedin_v2-0.9.5-py2-none-any.whl", "has_sig": false, "md5_digest": "aee0e624be42ff548216aa77b294cf7e", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 10202, "upload_time": "2018-10-15T04:33:05", "url": "https://files.pythonhosted.org/packages/c9/52/6945fd9448bf735b5e12c9b4c8ec09b8300a684a1578797ec689c7d1979f/python_linkedin_v2-0.9.5-py2-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "aee0e624be42ff548216aa77b294cf7e", "sha256": "9c9cd5b48340ee55af1761c6d79cefbdba39e145458c373c16b88dea93dc235a" }, "downloads": -1, "filename": "python_linkedin_v2-0.9.5-py2-none-any.whl", "has_sig": false, "md5_digest": "aee0e624be42ff548216aa77b294cf7e", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 10202, "upload_time": "2018-10-15T04:33:05", "url": "https://files.pythonhosted.org/packages/c9/52/6945fd9448bf735b5e12c9b4c8ec09b8300a684a1578797ec689c7d1979f/python_linkedin_v2-0.9.5-py2-none-any.whl" } ] }