简体   繁体   中英

Not getting full profile info from linkedin python

I am trying to get all the info I can from a public profile. Linkedin says that I should be able to get:

<id>
<first-name>
<last-name>
<headline>
<location>
  <name>
  <country>
    <code>
  </country>
</location>
<industry>
 <current-status>
<current-status-timestamp>
<connections total="" >
<summary/>
<positions total="">
  <position>
    <id>
    <title>
    <summary>
    <start-date>
      <year>
      <month>
    </start-date>
    <is-current>
    <company>
      <name>
    </company>
  </position>
</positions>

I am only able to get

<headline>
<first-name>
<last-name>

please let me know how to change my code:

CONSUMER_KEY = '9pux1XXXXXX'     # This is api_key
CONSUMER_SECRET = 'brtXoXXXXXXX'   # This is secret_key

USER_TOKEN = '27138ae8-5XXXXXXXXXXXXXXXXXXXXXXXXXXX'   # This is oauth_token
USER_SECRET = 'ca103e23-4XXXXXXXXXXXXXXXXXXXXXXXXXX'   # This is oauth_secret
RETURN_URL = 'http://localhost:8000'

from linkedin import linkedin
from oauthlib import *

# Define CONSUMER_KEY, CONSUMER_SECRET,  
# USER_TOKEN, and USER_SECRET from the credentials 
# provided in your LinkedIn application

# Instantiate the developer authentication class

authentication = linkedin.LinkedInDeveloperAuthentication(CONSUMER_KEY, CONSUMER_SECRET, 
                                                      USER_TOKEN, USER_SECRET, 
                                                      RETURN_URL, linkedin.PERMISSIONS.enums.values())

# Pass it in to the app...

application = linkedin.LinkedInApplication(authentication)

# Use the app....

a = application.get_profile(member_url='http://www.linkedin.com/pub/louis-litt/56/464/816')

When I run the program, all I get is:

{u'headline': u'Senior Associate at Pearson Hardman', u'lastName': u'Litt', u'siteStandardProfileRequest': {u'url': u'http://www.linkedin.com/profile/view?id=198202770&authType=name&authToken=yIgW&trk=api*a295771*s303335*'}, u'firstName': u'Louis'}

Linkedin现在限制了程序开发人员的访问权限,因此基本上您只能从以下4个方面进行选择:r_basicprofile,r_emailaddress,rw_company_admin,w_share

You're trying to get the public profile for a user, which will only yield certain fields, depending on what the user has chose to display on his public profile, and on LinkedIn's settings.

Try to grab your own profile http://api.linkedin.com/v1/people/~ , you should be able to retrieve all the fields.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM