You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This library provides a pure python interface for the LinkedIn **Connection**, **Profile**, **Search**, **Status**, **Messaging** and **Invitation** APIs.
7
+
This library provides a pure Python interface to the LinkedIn **Profile**, **Group**, **Company**, **Jobs**, **Search**, **Share**, **Network** and **Invitation** REST APIs.
11
8
12
9
`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.
13
10
@@ -20,9 +17,13 @@ You can install **python-linkedin** library via pip:
20
17
21
18
$ pip install python-linkedin
22
19
23
-
API Keys
24
-
--------------------
25
-
In order to use the LinkedIn API, you have an **application key** and **application secret**. For debugging purposes I can provide you those. You can use the following as api key and secret:
20
+
Authentication
21
+
-----------------------
22
+
23
+
LinkedIn REST API uses **Oauth 2.0** protocol for authentication. In
24
+
order to use the LinkedIn API, you have an **application key** and **application secret**. You can get more detail from `here <http://developers.linkedin.com/documents/authentication>`_.
25
+
26
+
For debugging purposes you can use the credentials below. It belongs to my test application. Nothing's harmful.
26
27
27
28
.. code-block:: python
28
29
@@ -32,102 +33,51 @@ In order to use the LinkedIn API, you have an **application key** and **applicat
32
33
You can also get those keys from `here <http://developer.linkedin.com/rest>`_.
For testing the library using an interpreter, use the quick helper.
39
-
40
-
.. code-block:: python
41
-
42
-
from linkedin import helper
43
-
api = helper.quick_api(<Your KEY>, <Your SECRET>)
44
-
45
-
This will print a url to the screen. Go into this URL using a browser, after you login, the method will return with an API object you can now use.
46
-
47
-
.. code-block:: python
48
-
49
-
api.get_profile()
50
-
51
-
Usage
52
-
------------
53
-
54
-
You can use **http://localhost** as the return url. Return URL is a url where LinkedIn redirects the user after he/she grants access to your application.
36
+
LinkedIn 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:
55
37
56
38
.. code-block:: python
57
39
58
40
from linkedin import linkedin
59
41
60
-
RETURN_URL='http://localhost'
61
-
api = linkedin.LinkedIn(<Your KEY>, <Your SECRET>, RETURN_URL)
62
-
result = api.request_token()
63
-
if result isTrue:
64
-
api.get_authorize_url() # open this url on your browser
This means that the **auth_verifier** value is 04874. After you get the verifier, you call the **.access_token()** method to get the access token.
56
+
This 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.
You can set/clear your status by calling **.set_status()** or **.clear_status()** methods. If you get False as the result, you can get the error by calling **.get_error()** method. Status message should be less than 140 characters. If it is too long, it is shortened. For more information, you can take a look at `DOC-1007 <http://developer.linkedin.com/docs/DOC-1007>`_
96
-
97
-
.. code-block:: python
98
-
99
-
result = api.set_status('This is my status.')
100
-
result = api.clear_status()
101
-
102
-
You can send a message to yourself or your connections' inboxes by simply calling **.send_message()** method. You can send your message at most 10 connections at a time. If you give more than ten IDs, the IDs after 10th one are ignored. For more information, you can take a look at `DOC-1044 <http://developer.linkedin.com/docs/DOC-1044>`_.
103
-
104
-
.. code-block:: python
105
-
106
-
result = api.send_message('This is a subject', 'This is the body')
You can send an invitation to your friend's email to invite them to join your LinkedIn network by simply calling **.send_invitation()** method.
74
+
This will print the authorization url to the screen. Go into this URL using a browser, after you login, the method will return with an API object you can now use.
118
75
119
76
.. code-block:: python
120
77
121
-
result = api.send_invitation('This is a subject', 'Join to my network', 'Ozgur', 'Vatansever', '[email protected]')
122
-
print result
123
-
True
124
-
125
-
result = api.send_invitation('This is a subject', 'Join to my network', 'Ozgur', 'Vatansever', 'ozgurvt')
LinkedIn API keys are throttled by default. You should take a look at `DOC-1112 <http://developer.linkedin.com/docs/DOC-1112>`_ to get more information.
81
+
More
82
+
-----------------
83
+
For more information, visit the `homepage <http://ozgur.github.com/python-linkedin/>`_ of the project.
0 commit comments