无法连接到Linkedin Python API

时间:2018-02-08 14:55:15

标签: python rest api linkedin

我正在遵循使用Python API连接到Linkedin的步骤。

我安装了软件包,但是当我尝试登录时:

from linkedin import linkedin

API_KEY = "################"
API_SECRET = "###############"
RETURN_URL = "http://localhost:8000"
authentication = linkedin.LinkedInAuthentication(API_KEY, API_SECRET, 
RETURN_URL, linkedin.PERMISSIONS.enums.values())
print authentication.authorization_url
application = linkedin.LinkedInApplication(authentication)

我收到以下错误消息:

Traceback (most recent call last):

 File "C:\Users\maria\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 2910, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)

File "<ipython-input-11-c4a6e3368b44>", line 1, in <module>
from linkedin import linkedin

 File "C:\Users\maria\Anaconda3\lib\site-packages\linkedin\linkedin.py", line 294
except (requests.ConnectionError, requests.HTTPError), error:
                                                     ^
SyntaxError: invalid syntax

有什么想法吗?这可能是什么问题?

1 个答案:

答案 0 :(得分:0)

如果您正在使用python 3

,请使用python3-linkedin

它与ozgur python-linkedin相同,但对于python 3