Current Job Title
Work History
Skills
Personal Email and Cell Phone
LinkedIn URL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
"""
I want to find phone numbers and emails for product managers with skills in python and javascript and 3+ years experience
"""
import requests, json
API_KEY = "####" # Enter your api key here
PDL_URL = "https://api.peopledatalabs.com/v5/person/search" # Person Search API Endpoint
REQUEST_HEADER = {
'Content-Type': "application/json",
'X-api-key': API_KEY
}
# Define our query for the Person Search API
# We're looking for product managers with skills in python and javascript and 3+ years experience
ES_QUERY = {
"query": {
"bool": {
"must": [
{"match_phrase" : {"job_title" : "product manager"}},
{"terms" : {"skills" : ["python", "javascript"]}},
{"range" : {"inferred_years_experience": { "gte" : 3 }}},
]
}
}
}
# Build the request and define how many matches we want returned
# We'll ask for 100 matches
REQUEST_PARAMS = {
"query": json.dumps(ES_QUERY),
"size": 100,
"pretty": True
}
# Send the API request
response = requests.get(PDL_URL, params=REQUEST_PARAMS, headers=REQUEST_HEADER).json()
# Parse the response
if response['status'] == 200:
# Candidates is an array of people matches
# Each match contains names, phone numbers, emails, social profiles and more
# See the full schema for all available fields at: https://docs.peopledatalabs.com/docs/fields
candidates = response['data']
# Write matches out to json
with open("my_candidates.json", 'w') as file_handle:
json.dump(candidates, file_handle, indent=2)
print(f"Found {len(candidates)} candidates")
else:
error = response['error']
print(f"Request was unsuccessful with status {response['status']}")
print(f"Error:
Type: {error['type']}
Message: {error['message']}")