Linkedin API 接口的 Python 使用

1 投票
1 回答
785 浏览
提问于 2025-04-17 06:54

我使用了这个库来发送API请求,并成功获取了访问令牌。

但是,文档没有解释之后应该如何使用_access_token_access_token_secret。我想应该有一个类似这样的函数:

set_access_token(_access_token, _access_token_secret)

但我在这个代码或文档中找不到这样的函数。

请帮我解决这个问题。

1 个回答

1

我没有使用过这个特定的库或接口,但在这种情况下,一个常见的做法是把令牌作为参数传递给后续的调用。查看源代码,我发现有一个叫做 get_user_profile 的函数,在__init__.py里:

def get_user_profile(self, access_token, selectors=None, headers=None, **kwargs):
    """
    Get a user profile.  If keyword argument "id" is not supplied, this
    returns the current user's profile, else it will return the profile of
    the user whose id is specificed.  The "selectors" keyword argument takes
    a list of LinkedIn compatible field selectors.
    """

所以我猜在这种情况下,你只需要把令牌作为第一个参数传进去就可以了。

撰写回答