-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinkedin_search.py
30 lines (25 loc) · 1.03 KB
/
linkedin_search.py
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
import requests
import json
def get_linkedin_data(company_name):
return [] #FIXME testing purposes while waiting for api key
linkedin_api_key='' #TODO waiting for api key approval
# Set the API endpoint and parameters
endpoint = "https://api.linkedin.com/v2/organizationAcls?q=roleAssignee&role=ADMINISTRATOR&projection=(elements*(organization~(localizedName,description)))"
params = {
"format": "json"
}
# Set the headers with your access token
headers = {
"Authorization": f"Bearer {linkedin_api_key}"
}
# Send the API request and parse the JSON response
response = requests.get(endpoint, params=params, headers=headers)
data = json.loads(response.content)
# Print the name and description of each organization
for element in data["elements"]:
organization = element["organization"]
name = organization["localizedName"]
description = organization["description"]
print(f"Name: {name}")
print(f"Description: {description}\n")
return data