有关从linkedin添加连接的Python脚本

时间:2018-10-07 23:19:33

标签: python python-2.7 linkedin linkedin-api invitation

我正在尝试在https://github.com/ozgur/python-linkedin

中使用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)

将authentication.authorization_url粘贴到浏览器中时,我得到“ redirect_uri与注册值不匹配”

有人可以帮忙吗?随意提出任何其他方法;) 谢谢

1 个答案:

答案 0 :(得分:1)

  1. 当您授予对应用程序的访问权限时,会将您重定向到返回网址,并在RETURN_URL后面附加以下查询字符串
  2. authentication.authorization_code = "the code provided"之后获取键值
  3. 将其添加到authentication.get_access_token()
  4. 之后
  5. 使用application = linkedin.LinkedInApplication(token='the token provided')
  6. 然后from linkedin import server application = server.quick_api(KEY, SECRET) application.get_profile()

快速用法示例:

        static bool
            // Deletes the pointer argument if adding fails.
            add_vehicle(
                src::Vehicle *
            ),
            exists_vehicle(
                std::string
            ),
            remove_vehicle(
                std::string
            );