从 linkedin 添加连接的 Python 脚本

问题描述 投票:0回答:1

我尝试在这里使用 python-linkedin 库 https://github.com/ozgur/python-linkedin通过脚本向 LinkedIn 联系人发送邀请

但是对于以下代码:

from linkedin import linkedin

API_KEY = 'wFNJekVpDCJtRPFX812pQsJee-gt0zO4X5XmG6wcfSOSlLocxodAXNMbl0_hw3Vl'
API_SECRET = 'daJDa6_8UcnGMw1yuq9TsjoO_PMKukXMo8vEMo7Qv5J-G3SPgrAV0FqFCd0TNjQyG'

RETURN_URL = 'https://localhost:8000'

authentication = linkedin.LinkedInAuthentication(API_KEY, API_SECRET, RETURN_URL) #, linkedin.PERMISSIONS.enums.values())
print authentication.authorization_url  # open this url on your browser
application = linkedin.LinkedInApplication(authentication)

我明白了

redirect_uri 与注册值不匹配

将authentication.authorization_url粘贴到浏览器中时。

python python-2.7 linkedin-api
1个回答
1
投票
  1. 当您授予应用程序访问权限时,您将被重定向到返回网址,并将以下查询字符串附加到您的 RETURN_URL
  2. http://localhost:8000/?code=
  3. 后的键值
  4. 添加在
    authentication.authorization_code = "the code provided"
  5. 之后
  6. 使用
    authentication.get_access_token()
  7. 然后
    application = linkedin.LinkedInApplication(token='the token provided')

快速使用示例:

from linkedin import server
application = server.quick_api(KEY, SECRET)
application.get_profile()
© www.soinside.com 2019 - 2024. All rights reserved.