如何使用Python和OAuth 2获取他人的LinkedIn信息?

-1 投票
1 回答
976 浏览
提问于 2025-04-18 16:53

1) 我在LinkedIn的开发者网站上按照步骤创建了密钥。

2) 使用Python和OAuth 2.0成功获取了我的信息:

import oauth2 as oauth
import time

url = "http://api.linkedin.com/v1/people/~"

consumer_key = 'my_app_key'
consumer_secret = 'my_app_secret_key'

oath_key = 'oath_key'
oath_secret = 'oath_secret_key'

consumer = oauth.Consumer(
     key=consumer_key,
     secret=consumer_secret)

token = oauth.Token(
     key=oath_key,
     secret=oath_secret)


client = oauth.Client(consumer, token)

resp, content = client.request(url)
print resp
print content

但是,我想知道其他人的信息,比如根据名字、姓氏和公司来获取信息。

https://developer.linkedin.com/documents/profile-api上似乎有很多有用的信息,但我看不懂。

那么,“id”这个值到底是什么呢?

1 个回答

0

你不能这样做。你可以获取某个人的公开资料,如果你知道他们的公开资料网址或者他们的唯一会员ID,但你不能通过其他方式来查询。

撰写回答