1
votes

I am trying to get LinkedIn connections through its python API.

Now the code can call get_profile() function, but when I tried application.get_connections(), it gives me the error showing:

linkedin.exceptions.LinkedInError: 403 Client Error: Forbidden for url: https://api.linkedin.com/v1/people/~/connections?oauth2_access_token=...

My linkedin application permissions only have 4 choices: r_basicprofile, r_emailaddress, rw_company_admin, w_share

The redirect url I am using is http://localhost/

So, do you know how can I get LinkedIn connections through python API?

My code:

from linkedin import linkedin as lk

new_token = [my token]

application = lk.LinkedInApplication(token=new_token)

p = application.get_profile()     # this one works
c = application.get_connections()
print p
print c
1

1 Answers

1
votes

The connections API requires the r_network scope to be granted by the user. According to this LinkedIn doc, certain scopes have been restricted and require developers to apply to LinkedIn's partner program to gain access to them.

Note: it also appears that this is the library you are using.