0

我正在尝试使用 IMDbPy,但出现 SSL 错误。我是 imdbpy 和 python 的新手,所以不确定我是否做错了什么。任何帮助将不胜感激。

from imdb import IMDb
ia = IMDb(accessSystem='html')
dp = ia.get_movie('1431045')
print(dp.keys())

这是堆栈跟踪:

2018-04-17 20:20:49,830 CRITICAL [imdbpy] /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/imdb/_exceptions.py:32: IMDbDataAccessError exception raised; args: ({'errcode': 'socket error', 'errmsg': '[Errno socket error] [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:719)', 'original exception': OSError('socket error', OSError('socket error', SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:719)'))), 'proxy': '', 'url': 'http://www.imdb.com/title/tt1431045/reference', 'exception type': 'IOError'},); kwds: {}
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 1693, in open
    return getattr(self, name)(url)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 1903, in open_https
    return self._open_generic_http(self._https_connection, url, data)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py", line 1852, in _open_generic_http
    http_conn.request("GET", selector, headers=headers)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1107, in request
    self._send_request(method, url, body, headers)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1152, in _send_request
    self.endheaders(body)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1103, in endheaders
    self._send_output(message_body)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 934, in _send_output
    self.send(msg)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 877, in send
    self.connect()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1261, in connect
    server_hostname=server_hostname)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 385, in wrap_socket
    _context=self)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 760, in __init__
    self.do_handshake()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 996, in do_handshake
    self._sslobj.do_handshake()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 641, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:719)
4

0 回答 0