根据这些文档,我应该请求“电子邮件地址”:https://developer.linkedin.com/documents/profile-fields
我假设这与任何其他用户数据调用一样工作,所以我将通过 oauth 过程获取正确的 token ,然后执行以下操作(在 Python 中使用 oauth2 库):
In [30]: url='http://api.linkedin.com/v1/people/~:(id,first-name,industry,email-address)'
In [31]: resp, content = client.request(url, 'GET')
In [32]: content
Out[32]: '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n<person>\n <id>t0tImGn-yi</id>\n <first-name>Jeff</first-name>\n <industry>Computer Software</industry>\n</person>\n'
如您所见,电子邮件地址不在回复中。
我还应该注意,我尝试使用以下方法在 requestToken 请求中指定范围:
request_token_url = 'https://api.linkedin.com/uas/oauth/requestToken? scope=r_basic_profile+r_emailaddress'
更新:我在这里找到了其他文档:https://developer.linkedin.com/documents/authentication#toggleview:id=python这似乎暗示我应该尝试通过此处访问电子邮件: resp, content = client.request('http://api.linkedin.com/v1/people/~/email-address', 'GET')
在这种情况下,内容返回“null”
最佳答案
您需要获取新的 API key ,然后在他们进行迁移时发出请求,请参阅 this
关于python - 如何使用 LinkedIn 的新 API 调用获取用户的电子邮件地址?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12100324/