簡體   English   中英

Python-LinkedIn API獲取配置文件錯誤

[英]Python - LinkedIn API get profile error

這是一個內部項目。 我的最終目標是獲取我的連接的詳細信息。 和我在同一個城市

我是使用LinkedIn API的新手。 我已使用此處答案中提到的代碼來生成訪問令牌。 現在,我使用下面的代碼來獲取我的LinkedIn個人資料。

application.get_profile(access_token['oauth_token'])

但是我越來越錯誤了。

Traceback (most recent call last):
  File "<pyshell#4>", line 1, in <module>
    application.get_profile(access_token['oauth_token'])
  File "C:\Python34\lib\site-packages\python_linkedin-2.0-py3.4.egg\linkedin\linkedin.py", line 189, in get_profile
    response = self.make_request('GET', url, params=params, headers=headers)
  File "C:\Python34\lib\site-packages\python_linkedin-2.0-py3.4.egg\linkedin\linkedin.py", line 169, in make_request
    params.update({'oauth2_access_token': self.authentication.token.access_token})
AttributeError: 'str' object has no attribute 'token'

有人可以幫幫我嗎?

我猜有點晚了。 但是,為將來參考,此錯誤來自以下事實:您需要從linkedin應用程序中顯式調用token元素。

例如,要生成應用程序,您需要輸入以下內容:

from linkedin_v2 import linkedin
application = linkedin.LinkedInApplication(token=access_token['oauth_token'])

然后,您可以從那里調用與application不同的函數(例如“ application.get_profile()”)。

BR

我認為您無需再次傳遞身份驗證令牌即可獲取個人資料。 我也在使用python lib。

application.get_profile()

應該返回您個人資料的基本信息。 然后研究使用選擇器指定所需的端點。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM