0

I have successfully set up Linkedin social authentication on my site with django-socialauth. I am able to retrieve top level profile fields, e.g. headline, no problem, with settings as below in my settings.py:

LINKEDIN_EXTRA_FIELD_SELECTORS = [
'email-address',
'headline',
'industry',
'location',
'picture-url',
'specialties',
'positions',
'relation-to-viewer',
'skills',
'public-profile-url',    
]
LINKEDIN_EXTRA_DATA = [('id', 'id'),
                   ('first-name', 'first_name'),
                   ('last-name', 'last_name'),] + [
                       (field, field.replace('-', '_'), True)
                       for field in LINKEDIN_EXTRA_FIELD_SELECTORS
                   ] 

Unfortunately, I'm stumped on how to access "lower levels" with Linkedin field selector syntax from this sort of interface.

For example, going from here: https://developer.linkedin.com/forum/how-get-api-current-company-position-using-parameter-current , a user's current company could be accessed using the syntax:

positions:(is-current,company:(name))

How could I include this selector in the settings.py variables above? Plugging the selector naively as above leads to to KeyErrors or Null values.

jennifer.cl
  • 205
  • 1
  • 2
  • 11

1 Answers1

0

Figured it out. After you've retrieved the dictionary "details" from linked in, you can retrieve current companies with:

 current_companies = [position['company']['name'] for position in details['positions']['position'] if position['is-current']=='true']
jennifer.cl
  • 205
  • 1
  • 2
  • 11