LinkedIn工作搜索REST API问题

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

我看到已经有类似的问题,但他们的回答解释了我在这里问一个类似的问题。我想利用LinkedIn的REST API进行个人求职,特别是利用工作搜索API功能。

我的问题是在检索访问令牌和自动授权以实际使用该应用程序。我尝试了下面的代码--第一个单元格是用来检索授权,第二个单元格是用来检索访问令牌。

from linkedin import linkedin

APPLICATON_KEY = 'XXXXXX'
APPLICATON_SECRET = 'XXXXX'

RETURN_URL = 'http://localhost:8000'
authentication = linkedin.LinkedInAuthentication(APPLICATON_KEY, APPLICATON_SECRET, RETURN_URL, 
linkedin.PERMISSIONS.enums.values())
print (authentication.authorization_url)  #open this url on your browser 

Access token:

authentication = linkedin.LinkedInAuthentication(
                APPLICATON_KEY,
                APPLICATON_SECRET,
                RETURN_URL,
                linkedin.PERMISSIONS.enums.values()
            )

authentication.authorization_code = '#############################################'
result = authentication.get_access_token()

print ("Access Token:", result.access_token)
print ("Expires in (seconds):", result.expires_in)

当我试图检索授权(访问令牌所需)时,出现以下错误。

File "/usr/local/lib/python3.6/dist-packages/linkedin/linkedin.py", line 294
    except (requests.ConnectionError, requests.HTTPError), error:
                                                         ^
 SyntaxError: invalid syntax

这是一个明显的语法错误 但我不知道到底是什么原因 我感觉可能是我的本地主机出了问题

python python-3.x rest linkedin-api
1个回答
1
投票

这个错误指向异常类和变量名之间的逗号。

逗号是Python 2.x的语法,因此这意味着 linkedin 您正在使用的库与 Python 3 不兼容。

如果您使用的是 本馆,你可以看到它已经5年没有更新了。这个 (PyPI)似乎是一个稍微新鲜的叉子。

© www.soinside.com 2019 - 2024. All rights reserved.