3

I am trying to find people in linkdein with their profile data using keywords.....

I follow below document.

https://github.com/ozgur/python-linkedin

The People Search API returns information about people. It lets you implement most of what shows up when you do a search for "People" in the top right box on LinkedIn.com. You can get more information from here.

application.search_profile(selectors=[{'people': ['first-name', 'last-name']}], params={'keywords': 'apple microsoft'})

# Search URL is https://api.linkedin.com/v1/people-search:(people:(first-name,last-name))?keywords=apple%20microsoft

{u'people': {u'_count': 10,
      u'_start': 0,
      u'_total': 2,
      u'values': [
       {u'firstName': u'John', u'lastName': 'Doe'},
       {u'firstName': u'Jane', u'lastName': u'Doe'}
      ]}}

Below code I tried. I am getting my profile details. But I want to search people based on keywords. application.search_profile function is giving me error.

People_search python document I searched but I couldn't find.

from linkedin import linkedin
from oauthlib import *


CONSUMER_KEY = 'XXXXX'
CONSUMER_SECRET = 'XXXXX'
USER_TOKEN = 'XXXXX'
USER_SECRET = 'XXXXX'
RETURN_URL = 'http://localhost:8000'

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


application = linkedin.LinkedInApplication(authentication)

g = application.get_profile()
print g

Output : {u'lastName': u'Gandhi', u'siteStandardProfileRequest': {u'url': u'https://www.linkedin.com/profile/view?id=184546922'}, u'id': u'izHKd17BFS', u'firstName': u'Karamchand'}  


application.search_profile(selectors=[{'people': ['first-name', 'last-name']}], params={'keywords': 'apple microsoft'})


while running I am getting below error.

Traceback (most recent call last):
  File "E:/Linkedin Scraping/Linkedin", line 22, in <module>
    application.search_profile(selectors=[{'people': ['first-name', 'last-name']}], params={'keywords': 'apple microsoft'})
  File "C:\Python27\lib\site-packages\linkedin\linkedin.py", line 189, in search_profile
    raise_for_error(response)
  File "C:\Python27\lib\site-packages\linkedin\utils.py", line 63, in raise_for_error
    raise LinkedInError(message)
LinkedInError: 403 Client Error: Forbidden: Unknown Error

And I also tried in rest console. https://api.linkedin.com/v1/people-search:(people:(first-name,last-name,headline,industry,email-address))?keywords=client%20engagement.

I want all 37934 result and I wanted to store all this result in csv? There I am getting result like this.

<?xml version="1.0" encoding="UTF-8"?>
<people-search>
  <people total="37934" count="10" start="0">
    <person>
      <first-name>Srinivas</first-name>
      <last-name>Manam</last-name>
      <headline>Sr.Manager - Client Engagement</headline>
      <industry>Information Technology and Services</industry>
    </person>
    <person>
      <first-name>*Anand</first-name>
      <last-name>Kumar (Andy)*</last-name>
      <headline>Assistant Manager - Client Engagement at Magna Infotech Ltd</headline>
      <industry>Information Technology and Services</industry>
    </person>
    <person>
      <first-name>Kailash</first-name>
      <last-name>Kulkarni.</last-name>
      <headline>Manager - IT Staffing Business Development & Delivery</headline>
      <industry>Computer Software</industry>
    </person>
    <person>
      <first-name>Ramesh</first-name>
      <last-name>A</last-name>
      <headline>Asst.Manager- Client Engagement (TAG)</headline>
      <industry>Human Resources</industry>
    </person>
</people-search>

How to get all 37934 result and store all this result in csv? I am new to python. I am facing difficulties on using this?

brandonscript
  • 68,675
  • 32
  • 163
  • 220
Karam Chand
  • 63
  • 1
  • 7
  • possible duplicate of [Parse JSON in Python](http://stackoverflow.com/questions/7771011/parse-json-in-python) – brandonscript Feb 27 '15 at 15:53
  • As far as I know to execute such queries you need to be part of a Partnership Program. – Akos K Feb 27 '15 at 18:48
  • Hai @remus. application.search_profile(selectors=[{'people': ['first-name', 'last-name']}], params={'keywords': 'apple microsoft'}) Function is not working.... I am getting error... – Karam Chand Mar 02 '15 at 05:31
  • `Traceback (most recent call last): File "E:/Linkedin Scraping/Linkedin", line 22, in application.search_profile(selectors=[{'people': ['first-name', 'last-name']}], params={'keywords': 'apple microsoft'}) File "C:\Python27\lib\site-packages\linkedin\linkedin.py", line 189, in search_profile raise_for_error(response) File "C:\Python27\lib\site-packages\linkedin\utils.py", line 63, in raise_for_error raise LinkedInError(message) LinkedInError: 403 Client Error: Forbidden: Unknown Error` – Karam Chand Mar 02 '15 at 05:32
  • @remus I am not getting any data while using get request in python. `https://api.linkedin.com/v1/people-search:(people:(first-name,last-name,headline,industry,email-address))?keywords=client%20engagement` – Karam Chand Mar 11 '15 at 08:53
  • Karam, I'd suggest reading over the Stack Overflow FAQ and how-to guides - you'll get better help that way. – brandonscript Mar 11 '15 at 09:15

0 Answers0