使用 LinkdAPI Python SDK 访问领英职业档案和公司数据。用于获取档案信息、公司数据、职位列表或搜索人员/职位。该技能使用 uv 脚本模式运行临时 Python 脚本,支持内联依赖。
LinkdAPI Python SDK.是一项面向实际任务的技能,主要用于Python SDK for LinkdAPI — 专业简介和公司数据来自LinkedIn, 且具有企业级可靠性.;Get your API key: https://linkdapi.com/ signup?;
从功能定位来看,该技能强调把分散的操作要求整理成清晰、可复用的处理流程,使用户能够围绕既定目标快速准备输入、选择执行方式并获得结构化结果。实际使用前应先确认任务范围、数据来源、运行环境、必要权限和关键参数,再依据技能说明逐步执行;若输入条件不完整,应先补齐信息或采用保守配置,避免因错误假设导致结果偏离需求。
执行过程中需要关注工具调用是否成功、接口或依赖是否可用、输出格式是否符合预期,并对异常提示、缺失字段和边界情况进行处理;涉及批量任务时,还应保存进度,避免中断后重复操作。该技能适合用于一次性任务,也可以接入自动化工作流,与其他技能或上层代理配合完成更完整的业务链路;在组合使用时,应明确每一步的输入输出关系,并避免不同步骤之间出现参数冲突。
LinkdAPI 的 Python SDK — 提供来自 LinkedIn 的专业个人资料与企业数据,具备企业级可靠性。
获取您的 API 密钥: https://linkdapi.com/signup?ref=K_CZJSWF
对具有内联依赖的临时 Python 脚本,使用 uv script 模式:
# /// script
# dependencies = [
# "linkdapi",
# ]
# ///
from linkdapi import LinkdAPI
client = LinkdAPI("YOUR_API_KEY")
profile = client.get_profile_overview("ryanroslansky")
print(profile)
执行命令:
uv run script.py
该命令将自动安装依赖、运行脚本并清理环境 —— 非常适合一次性任务。
始终以 uv script 块开头:
# /// script # dependencies = [ # "linkdapi", # # 如需其他依赖,请在此添加(例如 "rich"、"pandas") # ] # ///
获取个人资料概览:
# /// script
# dependencies = ["linkdapi"]
# ///
from linkdapi import LinkdAPI
client = LinkdAPI("YOUR_API_KEY")
profile = client.get_profile_overview("ryanroslansky")
if profile.get('success'):
data = profile['data']
print(f"{data['fullName']} - {data.get('headline', '')}")
print(f"Location: {data.get('location')}")
获取公司信息:
# /// script
# dependencies = ["linkdapi"]
# ///
from linkdapi import LinkdAPI
client = LinkdAPI("YOUR_API_KEY")
company = client.get_company_info(name="google")
if company.get('success'):
data = company['data']
print(f"{data['name']}")
print(f"Industry: {data.get('industry')}")
print(f"Employees: {data.get('employeeCount', 'N/A')}")
职位搜索:
# /// script
# dependencies = ["linkdapi"]
# ///
from linkdapi import LinkdAPI
client = LinkdAPI("YOUR_API_KEY")
result = client.search_jobs(
keyword="Software Engineer",
location="San Francisco, CA",
time_posted="1week"
)
if result.get('success'):
for job in result['data']['jobs'][:5]:
print(f"{job['title']} at {job['company']}")
批量个人资料增强(异步):
# /// script
# dependencies = ["linkdapi"]
# ///
import asyncio
from linkdapi import AsyncLinkdAPI
async def enrich():
async with AsyncLinkdAPI("YOUR_API_KEY") as api:
profiles = await asyncio.gather(
api.get_profile_overview("ryanroslansky"),
api.get_profile_overview("satyanadella"),
api.get_profile_overview("jeffweiner08")
)
for p in profiles:
if p.get('success'):
print(p['data']['fullName'])
asyncio.run(enrich())
当用户请求 LinkedIn 数据时:
"linkdapi",按需添加其他依赖)uv run 执行用户:“获取 jeffweiner08 的个人资料”
Agent:
cat > /tmp/linkdapi_query.py << 'EOF'
# /// script
# dependencies = ["linkdapi"]
# ///
from linkdapi import LinkdAPI
import os
client = LinkdAPI(os.getenv("LINKDAPI_API_KEY"))
profile = client.get_profile_overview("jeffweiner08")
if profile.get('success'):
data = profile['data']
print(f"Name: {data['fullname']}")
print(f"Headline: {data.get('headline', 'N/A')}")
print(f"Location: {data.get('location', 'N/A')}")
print(f"Company: {data.get('company', 'N/A')}")
else:
print(f"Error: {profile.get('message')}")
EOF
uv run /tmp/linkdapi_query.py
rm /tmp/linkdapi_query.py
要使用 LinkdAPI,您需要一个 API 密钥。请前往注册:
🔗 https://linkdapi.com/signup?ref=K_CZJSWF
完成注册后,您将获得一个 API 密钥,可用于认证所有请求。
将 API 密钥设为环境变量:
export LINKDAPI_API_KEY="your_api_key_here"
在脚本中使用:
import os
from linkdapi import LinkdAPI
client = LinkdAPI(os.getenv("LINKDAPI_API_KEY"))
get_profile_overview(username) — 基础个人资料信息get_profile_details(urn) — 详细个人资料数据get_contact_info(username) — 邮箱、电话、网站等联系方式get_full_profile(username=None, urn=None) — 完整个人资料get_full_experience(urn) — 工作经历get_education(urn) — 教育经历get_skills(urn) — 技能与推荐get_company_info(company_id=None, name=None) — 公司详情company_name_lookup(query) — 按名称搜索公司get_company_employees_data(company_id) — 员工统计数据get_company_jobs(company_ids) — 职位列表search_jobs(keyword, location, ...) — 搜索职位发布get_job_details(job_id) — 获取职位详情search_people(keyword, title, company, ...) — 查找人员search_companies(keyword, industry, ...) — 查找公司search_posts(keyword, ...) — 查找动态(Posts)AsyncLinkdAPI(速度提升约 40 倍)asyncio.gather() 中添加 return_exceptions=True,实现容错式错误处理async with)确保资源正确释放检查响应并妥善处理错误:
result = client.get_profile_overview("username")
if result.get('success'):
data = result['data']
# 处理数据
else:
print(f"API Error: {result.get('message')}")
完整 API 文档地址:https://linkdapi.com/docs
相关专题
热门下载
相关下载
精品课程
共6课时 | 54.7万人学习
共89课时 | 134.1万人学习
共49课时 | 82.5万人学习
最新文章