Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/358.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何访问linkedin API?_Python_Api_Python 2.7_Linkedin - Fatal编程技术网

Python 如何访问linkedin API?

Python 如何访问linkedin API?,python,api,python-2.7,linkedin,Python,Api,Python 2.7,Linkedin,我正在尝试使用python代码访问linkedin API。以下是我在windows计算机上运行的代码: from linkedin import server import webbrowser API_KEY = "<API_KEY>" API_SECRET = "<API_SECRET>" application = server.quick_api(API_KEY, API_SECRET) 我得到了一个我理解应该得到的url,但是这个错误的原因是什么? 此外,当

我正在尝试使用python代码访问linkedin API。以下是我在windows计算机上运行的代码:

from linkedin import server
import webbrowser
API_KEY = "<API_KEY>"
API_SECRET = "<API_SECRET>"
application = server.quick_api(API_KEY, API_SECRET)
我得到了一个我理解应该得到的url,但是这个错误的原因是什么? 此外,当我将url粘贴到浏览器中时,它会将我带到linkedin页面,并要求我提供其从未接受的凭据(我确信我输入的凭据是正确的)。它总是显示:

“HTTP错误404。找不到请求的资源。”


否则,我可以使用相同的凭据登录。

我还没有检查linkedin API,但我知道twitter的回调url必须是一个公共url,而不是像您的twitter那样的私有url。这不是两种情况吗?我已经能够使用某种不同的方法访问API。考虑到这种方法对其他人有效,我不太确定它有什么问题。下面是另一种方法:
>>> application = server.quick_api(API_KEY, API_SECRET)
https://www.linkedin.com/uas/oauth2/authorization?scope=r_basicprofile%20rw_nus%20r_network%20r_contactinfo%20w_messages%20rw_groups%20r_emailaddress%20r_fullprofile&state=0b0290ff6e51e14c5409434a6e4bf52f&redirect_uri=http%3A//localhost%3A8000/&response_type=code&client_id=<API_KEY>
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\IPython\core\interactiveshell.py", line 2731, in run_code
    exec code_obj in self.user_global_ns, self.user_ns
  File "<ipython-input-9-eb867f0fb231>", line 1, in <module>
    application = server.quick_api(API_KEY, API_SECRET)
  File "C:\Users\sony\AppData\Roaming\Python\Python27\site-packages\linkedin\server.py", line 24, in quick_api
    _wait_for_user_to_enter_browser(app)
  File "C:\Users\sony\AppData\Roaming\Python\Python27\site-packages\linkedin\server.py", line 38, in _wait_for_user_to_enter_browser
    httpd = BaseHTTPServer.HTTPServer(server_address, MyHandler)
  File "C:\Python27\lib\SocketServer.py", line 419, in __init__
    self.server_bind()
  File "C:\Python27\lib\BaseHTTPServer.py", line 108, in server_bind
    SocketServer.TCPServer.server_bind(self)
  File "C:\Python27\lib\SocketServer.py", line 430, in server_bind
    self.socket.bind(self.server_address)
  File "C:\Python27\lib\socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
error: [Errno 10013] An attempt was made to access a socket in a way forbidden by its access permissions